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.

> I also recommend the following article to those not aware of how badly
> designed JSON is: http://seriot.ch/parsing_json.php

JSON is not ideal, but compared with XML, it's a godsend.

What would be ideal? I think S-expressions would come close, but people
can mess up even them: <URL: https://www.ietf.org/rfc/rfc2693.txt>.


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to