↧
Answer by bbc for python: how do I parse a stream of json arrays with ijson...
You can use json.JSONDecoder.raw_decode to walk through the string. Its documentation indeed says: This can be used to decode a JSON document from a string that may have extraneous data at the end. The...
View ArticleAnswer by alexanderbird for python: how do I parse a stream of json arrays...
Here's a first cut at the problem that at least has a working regex substitution to turn a full string into valid json. It only works if you're ok with reading the full input stream before parsing as...
View Articlepython: how do I parse a stream of json arrays with ijson library
The incoming data resembles the following: [{ "foo": "bar" }] [{ "bar": "baz" }] [{ "baz": "foo" }] as you see, arrays of objects strung together. JSON-ish ijson is able to handle the first array, and...
View Article