[issue40623] JSON streaming

2020-05-14 Thread paul rubin
paul rubin added the comment: Also I didn't know about ndjson (I just looked at it, ndjson.org) but its existence and formalization is even more evidence that this is useful. I'll check what the two different python modules linked from that site do that's different from your example of

[issue40623] JSON streaming

2020-05-14 Thread paul rubin
paul rubin added the comment: It's coming back to me, I think I used the no-separator format because I made the multi-document input files by using json.dump after opening the file in append mode. That seems pretty natural. I figured the wikipedia article and the json.tool patch just

[issue40623] JSON streaming

2020-05-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: If you want to read json objects encoded one per line (JSON Lines or NDJSON), you can do this with just two lines of code: for line in file: yield json.loads(line) This format is not formally standardized, but it is popular because its support

[issue40623] JSON streaming

2020-05-14 Thread paul rubin
paul rubin added the comment: Note: the function in my attached file wants no separation at all between the json docs (rather than a newline between them), but that was ok for the application I wrote it for some time back. I forgot about that when first writing this rfe so thought I better

[issue40623] JSON streaming

2020-05-14 Thread paul rubin
Change by paul rubin : Added file: https://bugs.python.org/file49154/jsonstream.py ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue40623] JSON streaming

2020-05-14 Thread paul rubin
New submission from paul rubin : This is a well-explored issue in other contexts: https://en.wikipedia.org/wiki/JSON_streaming There is also a patch for it in json.tool, for release in 3.9: https://bugs.python.org/issue31553 Basically it's often convenient to have a file containing a list