Create a Maven project in the Eclipse IDE for JSON processing. Select File | New | Other, and in the New gallery, select Maven | Maven Project, as shown here:
In the New Maven Project wizard, select Create a simple project and click on Next, as shown in the following screenshot:
Specify
Group Id (jboss-json
), Artifact Id (json
), Version (1.0
), Packaging (war
), and Name (json
) for New Maven Project and click on Finish, as shown here:
A new Maven project gets created as shown here:
Next, add JSPs to process JSON. Add createJson.jsp
to create JSON and add parseJson.jsp
to parse JSON. Select File | New | Other, and in the New gallery, select Web | JSP File and click on Next, as shown here:
Select the webapp
folder, specify File name (createJson.jsp
), and click on Finish, as shown here:
The createJson.jsp
file gets added to the Maven project. Similarly, create parseJson.jsp
. The directory structure of the Maven web application in the Eclipse IDE is shown in the following screenshot:
Add the jboss-json-api_1.0_spec
, webapp-javaee7
and javax.ws.rs-api
dependencies to pom.xml
:
<dependencies> <dependency> <groupId>org.jboss.spec.javax.json</groupId> <artifactId>jboss-json-api_1.0_spec</artifactId> <version>1.0.0.Final</version> </dependency> <dependency> <groupId>org.codehaus.mojo.archetypes</groupId> <artifactId>webapp-javaee7</artifactId> <version>1.1</version> </dependency> <dependency> <groupId>javax.ws.rs</groupId> <artifactId>javax.ws.rs-api</artifactId> <version>2.0</version> </dependency> </dependencies>