Facilitating the spread of knowledge and innovation in professional software development



Choose your language

InfoQ Homepage News Public Review of JSON-P Specification 1.1 is Now Open

Public Review of JSON-P Specification 1.1 is Now Open

This item in japanese


Public review of JSR 374: Java API for JSON Processing (JSON-P) version 1.1 is now open. This version is expected to be included in the release of J2EE 8 and keeps JSON-P current with JSON IETF standards. It includes support for:

JSON-P was introduced in 2013 with the release of J2EE 7, as an alternative to Gson and Jackson. It was designed to parse, generate, and query standard JSON documents.

JSR-367: Java API for JSON Binding (JSON-B), will also be included in the release of J2EE 8. JSON-B  was designed to bind JSON documents to Java objects. InfoQ has previously reported on the public review of JSON-B.

Getting Started

To get started with a JSON-P parse and pointer example, consider the following JSON file:

    "publication":"New Vaadin Spring Release Introduces Enhanced View Management",
    "publicationDate":"2016-12-30 00:00:00",
    "author":"Michael Redlich",
    "publication":"Pivotal Releases First Milestone of Next-Generation Spring Data Featuring Reactive Database Access",
    "publicationDate":"2017-01-19 00:00:00",
    "author":"Michael Redlich",
    "publication":"Netflix Introduces Hollow, a Java Library for Processing In-Memory Datasets",
    "publicationDate":"2017-01-31 00:00:00",
    "author":"Michael Redlich",

The JSON file may be parsed using JsonParser:

public static final String JSON_FILE = "publications.json";

InputStream fis = new FileInputStream(JSON_FILE);

JsonParser parser = Json.createParser(fis);
while(parser.hasNext()) {
    JsonParser.Event event =;
    switch(event) {
        case START_ARRAY:
        case END_ARRAY:
        case START_OBJECT:
        case END_OBJECT:
        case VALUE_FALSE:
        case VALUE_NULL:
        case VALUE_TRUE:
        case KEY_NAME:
            System.out.print(event.toString() + " " + parser.getString() + " - ");
        case VALUE_STRING:
        case VALUE_NUMBER:
        System.out.println(event.toString() + " " + parser.getString());

Using JsonPointer, a particular element in the JSON file can be found:

InputStream fis = new FileInputStream(JSON_FILE);

JsonReader jsonReader = Json.createReader(fis);
JsonArray jsonArray = jsonReader.readArray();
JsonPointer pointer = Json.createPointer("/1/publication");
JsonValue publication = pointer.getValue(jsonArray);
System.out.println(i + ": " + publication);

This example will find and display the second publication in the above JSON file. We prepared an entire project demonstrating JSON-P, Gson, and Jackson, which can be found on GitHub.

The latest specification can be downloaded for review from the JSR-374 website.

Well known Java EE evangelist Reza Rahman recently blogged about the role of JSON within J2EE 8:

These two APIs together are extremely important in making JSON a first class citizen of the standard Java platform, just like JAXP (Java API for XML Processing) and JAXB (Java API for XML Binding) did many years ago for XML. With these two APIs in place Java developers can simply think of JSON as yet another Java serialization format. No more third party libraries and no more configuration - things will simply work out of the box when it comes to processing JSON. In my view these APIs are so critical they should indeed be moved to a modular Java SE release, much like JAXB and JAXP are already a part of Java SE.

The final versions of JSON-P and JSON-B are expected to be released in April 2017.


Additional information on JSON-P can be found via the following resources:

Rate this Article


Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

  • Cool

    by Jun Deng,

    Your message is awaiting moderation. Thank you for participating in the discussion.


Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p


Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.