In this tutorial series, I am going to explain about javax.json package. ‘JSR 374’ documents the API contract for JSON processing.
javax.json package is part of Java EE and it well documented all the interfaces. You need to provide an implementation library to work with json using javax.json apis (Ex: javax.json artifact from glasshfish provided implementation for javax.json package).
I am using following dependencies for this tutorial.
<dependencies>
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>javax.json</groupId>
<artifactId>javax.json-api</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.json</artifactId>
<version>1.1.4</version>
</dependency>
</dependencies>
- Create json and print
- Convert json string to JsonObject
- Convert object to json string
- JsonArrayBuilder: build arrays
- Pretty print json
- Build JsonObject from string
- Get an object from json string
- Get list from JsonArray
- Querying using object model api
- Query json using streaming api
- Read json from a file
- Write json string to a file
- Generate json using JsonGenerator
You can download the example applications from this link.
https://github.com/harikrishna553/javax-json-tutorial
No comments:
Post a Comment