Java API for JSON Processing (JSR 353)

Written on March 25, 2014

Computer programs are the most complex things that humans make.

Douglas Crockford

JSON (JavaScript Object Notation) is a widely used, lightweight, simple data-interchange format. JSON is not so new but there is, since a few months, a formal ECMA standardising JSON: “ECMA 404 - The JSON Data Interchange Format”. ECMA 404 is probably the sweetest and easiest specification to read and grasp! The document is 14 pages long but if you remove all the decorations, the specification itself is not even 7 pages long!

Java API for JSON Processing (JSR 353) is one of the 4 new APIs added to Java EE 7 alongs with the Batch API (JSR 352), the WeSocket API (JSR 356) and the Concurrency Utilities for Java EE API (JSR 236). JSR 353 provides an API to parse, transform, and query JSON data using the object model or the streaming mode.

Java has a long history of various JSON APIs but the value of JSON-P (JSR 353) is the fact that it has been standardised. That means that we can expect this API to work seamlessly on any Java EE 7 implementations, i.e. GlassFish 4, JEUS 8 and WildFly 8 today. And this is juts the beginning, we can also expect the adoption of JSON-P API to rapidly grow. For example, the upcoming WebLogic 12.1.3 will add support for various Java EE 7 APIs including JSON-P, see here. It should be mentioned that binding is not yet covered by this specification but JSON-B is high on the wish-list for Java EE 8.

To know more about JSON-P, you can read the JSON-P chapter of the Java EE 7 Tutorial.

Originaly posted on The Aquarium blog.