Closed emattheis closed 3 years ago
After thinking about this more carefully, it seems that providing access to the current event is likely much more efficient than trying to provide lookahead support. For the use case I'm interested in, a JsonParser
instance could be advanced to the correct location and then passed to a Jsonb
instance to deserialize a mapped POJO but the Jsonb
needs to be aware of the current event, otherwise it must call next()
which means the caller has to advance the stream only to the position directly before the correct location. This forces the caller to make assumptions about the future state of the stream and depend on error handling to recover if those assumptions don't hold.
I believe this is covered by #282
I'm interested in using JSON-P and JSON-P together in order to efficiently process large JSON data sets while retaining the convenience of POJO mapping. I've raised an issue with the JSON-B API to that end, but one of the sticking points is the ability to properly position a
JsonParser
for use by JSON-B. It would be convenient ifJsonParser
had apeek()
method that could return the next event without consuming it.