Closed NielsUll closed 2 years ago
you can try the new API. https://github.com/jsurfer/JsonSurfer#collect-value-by-jsonpath
But that will still parse the entire message? I tested this trying to read this:
{ "key1": "value1", "key2": "value2", something which is definitly not valid json
I can read value1 using collectOne(), but not using the new API - it will try to parse everything.
My issue is not with invalid json as above, but with parsing several megabytes of json when the value I need is within the first 100 bytes or so.
If you want to stop immediately on the first occurrence. this example may help: https://github.com/jsurfer/JsonSurfer#stoppable-parsing
Thank you - I had apparently missed that.
I need to extract one element from the beginning of a large json structure, and would like to abort parsing as soon as it is found. The collectOne() looks like just the thing, but it is deprecated.
The CollectOneListener is not public, so I have to clone that class in my own code?