On 17 Jul 2013 20:40, "Sol Toure" wrote:
>
> I didn't look into using YAML processor.
> Also that would have required pre-processing the data to add the
separators.
> With this method you don't need the separators. You can have 0 or more
white space between objects:
>
> for obj in JSONStream(Strin
I didn't look into using YAML processor.
Also that would have required pre-processing the data to add the separators.
With this method you don't need the separators. You can have 0 or more
white space between objects:
for obj in JSONStream(StringIO('''{"one":1}{"two":2}{"three":3} 4
{"five": 5
Looks interesting. In YAML we used three dashes as the "stream
separator".
So already a YAML processor could handle a JSON stream ...
>>> for doc in yaml.load_all("""
... --- {"one": "value"}
... --- {"two": "another"}
... ---
... {"three": "a third item in the stream",
... "with": "more
I was trying to process a large file containing a number of distinct JSON
object as a stream, but I couldn't find anything readily available to
that. (maybe I didn't search hard enough)
So I came up with this:
https://github.com/qrtz/JSONStream
I hope you find it useful too.
--
http://mail.pytho