JSON processing
JSON-P provides the ability for parsing, generating, querying, and transforming JSON documents in Java. The API allows producing and consuming JSON text in a streaming manner as well as a Java object model. Java EE 7 introduced the JSON-P specification for working with JSON documents. Java EE 8 is taking this a step further to keep it updated with the newer RFC standards by updating the version to JSON-P 1.1. With this, we have new features, such as:
- JSON Pointer: RFC 6901
- JSON Patch: RFC 6902
- JSON Merge Patch: RFC 7386/7396
To work with JSON, you can use any JEE 8 compliant server which provides the json-api 1.1
, a corresponding maven dependency specific to JSON API, shown as follows:
javax.json javax.json-api <version>1.1</version> <scope>provided</scope> </dependency>
With the API dependency set, you can write JSON processing code in either using the object model or the streaming fashion, shown as follows:
- Object Model approach: JSON Object...