Re: multiple JSON documents in one file, change proposal

2018-12-03 Thread Rhodri James
On 01/12/2018 10:10, Marko Rauhamaa wrote: In my case, I need an explicit terminator marker to know when a JSON value is complete. For example, if I should read from a socket: 123 [snip] You're having to invent a transport protocol to encapsulate your data protocol because you don't

Re: multiple JSON documents in one file, change proposal

2018-12-01 Thread Akkana Peck
Grant Edwards writes: > 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. Then the

Re: multiple JSON documents in one file, change proposal

2018-12-01 Thread Grant Edwards
On 2018-11-30, Marko Rauhamaa wrote: > Paul Rubin : >> 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

Re: multiple JSON documents in one file, change proposal

2018-12-01 Thread Ben Bacarisse
Marko Rauhamaa writes: > Chris Angelico : > >> On Sat, Dec 1, 2018 at 10:16 PM Marko Rauhamaa wrote: >>> and the framing format is HTTP. I will need to type something like this: >>> >>>POST / HTTP/1.1^M >>>Host: localhost^M >>>Content-type: application/json^M >>>Content-length:

Re: multiple JSON documents in one file, change proposal

2018-12-01 Thread Marko Rauhamaa
Chris Angelico : > On Sat, Dec 1, 2018 at 10:16 PM Marko Rauhamaa wrote: >> and the framing format is HTTP. I will need to type something like this: >> >>POST / HTTP/1.1^M >>Host: localhost^M >>Content-type: application/json^M >>Content-length: 54^M >>^M >>{ >>

Re: multiple JSON documents in one file, change proposal

2018-12-01 Thread Chris Angelico
On Sat, Dec 1, 2018 at 10:16 PM Marko Rauhamaa wrote: > > Chris Angelico : > > On Sat, Dec 1, 2018 at 9:16 PM Marko Rauhamaa wrote: > >> The need for the format to be "typable" (and editable) is essential > >> for ad-hoc manual testing of components. That precludes all framing > >> formats that

Re: multiple JSON documents in one file, change proposal

2018-12-01 Thread Marko Rauhamaa
Chris Angelico : > On Sat, Dec 1, 2018 at 9:16 PM Marko Rauhamaa wrote: >> The need for the format to be "typable" (and editable) is essential >> for ad-hoc manual testing of components. That precludes all framing >> formats that would necessitate a length prefix. HTTP would be >> horrible to

Re: multiple JSON documents in one file, change proposal

2018-12-01 Thread Chris Angelico
On Sat, Dec 1, 2018 at 9:16 PM Marko Rauhamaa wrote: > > Paul Rubin : > > > Marko Rauhamaa writes: > >> Having rejected different options ( >> https://en.wikipedia.org/wiki/JSON_streaming>), I settled with > >> terminating each JSON value with an ASCII NUL character, which is > >> illegal in

Re: multiple JSON documents in one file, change proposal

2018-12-01 Thread Marko Rauhamaa
Paul Rubin : > Marko Rauhamaa writes: >> Having rejected different options (> 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. > > Thanks, that Wikipedia article is helpful. I'd prefer

Re: multiple JSON documents in one file, change proposal

2018-11-30 Thread Thomas Jollans
On 30/11/2018 23:40, Marko Rauhamaa wrote: > Paul Rubin : >> 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

Re: multiple JSON documents in one file, change proposal

2018-11-30 Thread Chris Angelico
On Sat, Dec 1, 2018 at 9:46 AM Marko Rauhamaa wrote: > > Paul Rubin : > > 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

Re: multiple JSON documents in one file, change proposal

2018-11-30 Thread Cameron Simpson
On 01Dec2018 00:40, Marko Rauhamaa wrote: Paul Rubin : 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

Re: multiple JSON documents in one file, change proposal

2018-11-30 Thread Marko Rauhamaa
Paul Rubin : > 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.