[New-bugs-announce] [issue40623] JSON streaming

paul rubin report at bugs.python.org
Thu May 14 06:35:58 EDT 2020


New submission from paul rubin <phr-pythonbugs at nightsong.com>:

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 of json docs, one per line.  However, there is no convenient way to read them back in one by one, since json.load(filehandle) barfs when it sees the unexpected newline at the end of the first doc.

It would be great if the json module itself had a function to handle this.  I have an awful hack that I use myself, that is not suitable for a production library, but I'll attach it to show what functionality I'm suggesting.  I hope this is simple enough to not need a PEP.  Thanks!

----------
components: Library (Lib)
files: jsonstream.py
messages: 368823
nosy: phr
priority: normal
severity: normal
status: open
title: JSON streaming
type: enhancement
Added file: https://bugs.python.org/file49153/jsonstream.py

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


More information about the New-bugs-announce mailing list