[issue34529] add the option for json.dumps to return newline delimited json
Serhiy Storchaka
report at bugs.python.org
Thu Aug 30 00:26:04 EDT 2018
Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:
This format is known as JSON Lines: http://jsonlines.org/. Its support in the user code is trivial -- just one or two lines of code.
Writing:
for item in items:
json.dump(item, file)
or
jsondata = ''.join(json.dumps(item) for item in items)
Reading:
items = [json.loads(line) for line in file]
or
items = [json.loads(line) for line in jsondata.splitlines()]
See also issue31553 and issue34393. I think all these propositions should be rejected.
----------
nosy: +serhiy.storchaka
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34529>
_______________________________________
More information about the Python-bugs-list
mailing list