-
-
Notifications
You must be signed in to change notification settings - Fork 51
Open
Labels
Description
The README for this module is a bit daunting... lots of people are looking simply to parse a large JSON file and get objects one by one:
- SO - Parse large JSON file in Nodejs and handle each object independently (answers recommend this module)
- SO - Parse large JSON file in Nodejs (answers recommend the deprecated JSONstream)
It would be really helpful to have a simple basic canonical example of how to parse a large JSON file that consists of an arbitrary number of objects in an array. Ideally, that would be a generator pattern, so streaming can be aborted at will, and items iterated through with a for loop like with Python's ijson library:
with open('large_file.json', 'rb') as f:
objects = ijson.items(f, 'item')
for o in objects:
add_object(o)cjk, RichardJECooke, AudunVN, jamie-allen-worldover and noratarano