Processing JSON in a RESTful web service

The JSON format is commonly used in RESTful web services to exchange messages. In this section, we will discuss how the Java API or JSON processing is used in a RESTful web service. First, add the RESTful web service dependency to pom.xml:


Create a sample REST web service to test the JSON API. Create a resource class JsonResource annotated with @PATH to identify the URI path. Here's how we accomplish this:

package org.json; import; import; import; import; import javax.json.*; import; import ...

Get Advanced Java® EE Development with WildFly® now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.