isagalaev / ijson

Iterative JSON parser with Pythonic interface
http://pypi.python.org/pypi/ijson/
Other
615 stars 134 forks source link

Ability to reinitialize parser mid stream #67

Closed garthgoodson closed 4 years ago

garthgoodson commented 6 years ago

I'm trying to parse multiple discrete json object per file: E.g. { "object": 1 } { "object": 2 }

And while I can parse the first object, I'd like to be able to reinitialize the parser such that I can start from scratch with the second object (since these items are not in a json array). Currently I get an Additional data error when I hit the second object.

cablehead commented 6 years ago

An example use case this would make possible, receive json encoded stats emitted periodically from a server over a long lived socket connection.

SalomonSmeke commented 5 years ago

https://github.com/isagalaev/ijson/issues/75

This is already implemented per the original issue. It is however behind a bug who's fix is not published.