[JSON_PROCESSING_SPEC-9] Adding methods to JsonParser to get objects Created: 14/Jun/12  Updated: 20/Sep/14

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

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


 Description   

Something like the following, that gives the objects from the parser

/**

  • getJsonValue(JsonObject.class) is valid in START_OBJECT state,
  • moves cursor to END_OBJECT
    *
  • getJsonValue(JsonArray.class) is valid in START_ARRAY state
  • moves cursor to END_ARRAY
    *
  • getJsonValue(JsonString.class) is valid in VALUE_STRING state
    *
  • getJsonValue(JsonNumber.class) is valid in VALUE_NUMBER state
    */
    public <T extends JsonValue> T getJsonValue(Class<T> clazz) { return null; }


 Comments   
Comment by kchung [ 20/Sep/14 ]

This issue, together with issue 29, would be useful for processing big JSON data. It is important to be able to load the JSON values are of interest and skip those that are not.

However, it is most likely that the criteria for getting or skipping JSON values lies within the values themselves. For instance, say we have an array of objects representing the contacts, and we are only interested in getting the contacts who are females that live in New York city. We'll need to process some parts of the object to determine if it should be loaded or skipped, and we cannot make that decision at the beginning of an object. How to factor that into the API is the challenge.

Generated at Tue Mar 28 23:33:14 UTC 2017 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.