3 ms·
But why JSON and not CSV [1]? Most of what the article suggests, like formatting the output as lines and flattening, is how CSV works. CSV is much easier to par
by hgs3 2y ago
But why JSON and not CSV [1]? Most of what the article suggests, like formatting the output as lines and flattening, is how CSV works. CSV is much easier to parse than JSON (use split(",") or the equivalent). A complete record (JSON object) of CSV data can be parsed in a single line, unlike typical JSON. The line-based nature of CSV makes it far more fault tolerant to broken streams/truncation and more in-line with standard Unix conventions.
[1] https://en.wikipedia.org/wiki/Comma-separated_values https://en.wikipedia.org/wiki/Comma-separated_values
- photonthug 2y agoNested objects? JSON holds json fine, with arbitrary depth, retaining ability to print pretty and parse. Not sure how that’s going to work with csv
- kortex 2y agoA) Csv isn't actually a standard, so there's no one universal way of dealing with it (we can get really close). B) the keys and values are disjointed in csv as separate rows/columns, vs key:value C) yes flat is better but when you need nested, nested is useful
- zulu-inuoe 2y agoOne of my values contains a literal ,