Hi!
Something I came across and currently missing in the JSON-P spec imo:
Currently it's not easily possible to read a JsonObject from a JsonParser.
That could be solved by enhancing the JsonReaderFactory to create a JsonReader from a given Parser.
Why do I need this:
Usually stream processing is much faster than object tree creation. But sometimes you need to first read the whole 'layer' of the current stream (start to end of the current object basically) and then do some fallback processing.
This is currently only possible by reading the whole JsonStructure and then handle it that way. After that part got processed I simply continue with stream processing.
A sample: I like to lookup a certain Json attribute, and depending on it's value (or whether it exists at all) the object conversion processing needs to work a bit different.
There are 2 solutions to this imo:
1.) getting a JsonReader from an existing JsonParser
2.) push-back handling in the JsonParser (similar to what XMLPP does with XML)
Think option 1 is much easier to implement for now.
Any thoughts?
LieGrue,
strub