I am building a tool to parse huge JSON around 1GB. In that logic, I am creating JsonParser
object keep reading till it reaches expected JsonToken
. Now I create another JsonParser
(called child), which should be starting from previous JsonParser token position without much overhead. Is there a way to do that in JasonParser API for that? I am using skipChildren()
, which is also taking time in my scenario.
Asked
Active
Viewed 787 times
0

Pokuri
- 3,072
- 8
- 31
- 55
1 Answers
0
You can try to call releaseBuffered(...)
to get the data that are read but not consumed by the parser, and then prepend these data to the input stream (getInputSource()
) to somehow parse the resulting stream (one way to do this might be to use an input stream that supports marks when constructing the parser).
However, since you're already using a stream based API, you probably won't get better performance than with skipChildren()
.

aventurin
- 2,056
- 4
- 26
- 30