[issue40623] JSON streaming

Serhiy Storchaka report at bugs.python.org
Thu May 14 07:09:31 EDT 2020


Serhiy Storchaka <storchaka+cpython at gmail.com> 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 in any programming language is trivial.

If you want to use more complex format, I afraid it is not popular enough to be supported in the stdlib. You can try to search third-party library which supports your flavour of multi-object JSON format or write your own code if this format is specific for your application.

----------
nosy: +serhiy.storchaka

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40623>
_______________________________________


More information about the Python-bugs-list mailing list