On 2018-11-30, Marko Rauhamaa <ma...@pacujo.net> wrote: > Paul Rubin <no.email@nospam.invalid>: >> Maybe someone can convince me I'm misusing JSON but I often want to >> write out a file containing multiple records, and it's convenient to >> use JSON to represent the record data. >> >> The obvious way to read a JSON doc from a file is with "json.load(f)" >> where f is a file handle. Unfortunately, this throws an exception > > I have this "multi-JSON" need quite often. In particular, I exchange > JSON-encoded messages over byte stream connections. There are many ways > of doing it. Having rejected different options (<URL: > https://en.wikipedia.org/wiki/JSON_streaming>), I settled with > terminating each JSON value with an ASCII NUL character, which is > illegal in JSON proper.
This is what "archive" file formats are for. Just use tar, zip, ar, cpio, or some other file format designed to store multiple "files" of arbitrary data -- there are plenty of "standard" formats to choose from and plenty of libraries to deal with them. -- Grant -- https://mail.python.org/mailman/listinfo/python-list