spark85 / json-path

Automatically exported from code.google.com/p/json-path
0 stars 0 forks source link

read should not read whole JSON when possible (streaming support) #67

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. jsonPath/*compiled from say: 
"$.store.book[0].title"*/.read(referenceToLargeJSONFile)

What is the expected output? What do you see instead?
It should give the value at store.book[0].title, but it gives OutOfMemoryError 
as it tries to read the whole JSON file to memory.

It would be very useful if it could give a good heuristic whether it can 
provide the results (even better the results as a stream/iterator) without 
reading the whole JSON. (Not necessarily need to support all JSON providers.) 
This might not be allways possible, some script expressions can be too complex 
probably. Anyway, a good heuristic (similar to isDefinite()) would be useful.

Thanks for considering this addition.

Original issue reported on code.google.com by bakos.ga...@mind-era.com on 31 Jan 2015 at 10:59

GoogleCodeExporter commented 9 years ago

Original comment by kalle.st...@gmail.com on 3 Feb 2015 at 12:52