[JSON_PROCESSING_SPEC-58] Add Support for JSON Queries Created: 28/May/13  Updated: 23/Feb/15

Status: Open
Project: json-processing-spec
Component/s: None
Affects Version/s: 1.1
Fix Version/s: None

Type: New Feature Priority: Major
Reporter: reza_rahman Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


I received feedback that JSON-P should add support for being able to query JSON objects (a la XPath). I am aware that this is an immature field with some competing approaches but think this is very valid feedback particularly in making JSON-P more compelling vis-à-vis existing JSON processing solutions.

Do let me know if anything needs to be explained further - I am happy to help.

Please note that these are purely my personal views and certainly not of Oracle's as a company.

Comment by kchung [ 06/May/14 ]

There is currently no standard for JSON queries, so it would be premature to put query into JSON APIs.

Since JsonObject is a Map, and JsonArray a List, some querying should be possible using the Lambda expression in JDK 8. For instance,

    .filter(p->p.getString("city").equals("Santa Clara"))
    .forEach(p->System.out.println(p.getString("firstName") + " " + p.getString("lastName"));)

would print out the names of your contacts residing in Santa Clara. With a little more work, it should be possible to return a JSON document of the query results.

Maybe the spec should look into providing better support for doing queries in Lambda?

Comment by mitemitreski [ 23/Feb/15 ]

Would filtering or transformations using JSON pointer make sense?

Generated at Sat Oct 22 21:01:28 UTC 2016 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.