Hacker News new | ask | show | jobs
by natermer 2494 days ago
If GNU decided tomorrow that all utilities need to have a --json output argument then that would make me a very happy person.
2 comments

Better than nothing, but the problem with that is that you can't construct a deep, lazily evaluated pipeline. JSON can't be outputted until all the data is collected.
There's a streaming format which is used for this: JSON Lines [1] AKA newline-delimited JSON [2].

[1] http://jsonlines.org/

[2] http://ndjson.org/

That still limits us too much due to the rather severely limited available data types (although arbitrary types could be serialized into binary/string data, I guess...)
Funny that you should mention this. I just hit that problem yesterday. The lack of a binary type is a problem. This is the same thing that hit XML. Unfortunately (or fortunately), the best solution is still the MIME stuff.