Re:Time to retire the CSV?
by daxuak on Wednesday August 18, 2021 @11:20AM
(#28222380)
Human can't efficiently write or parse XML or json, though. In some scenarios CSV hits the right spot to be accessible to human and computer, and the table can be laid out so that one can sort/grep/awk to quickly gain some insight.
[ Parent
| on HN ]
As someone that works with maven and npm.... what?
This is valid JSON
[["bob", "jones", 1, 22],
["frank", "was", 32, 45]]
That's unreadable and unparsable by a human?Not only is JSON often more parsable, because it's structured it also becomes a lot easier to query.
I grep and awk xml and json stuff all the time. I also have the added bonus of being able to use `jq` for json content.
Late for the response but: JSON naturally encourages data to structural in ways that are often nested. In your example, if there's one or two additional layers of context (say, affiliation of the two persons), maintaining a CSV-like layout will be more cumbersome and unnecessary. I don't see many CSV or tabular-like JSON/XML in the wild and they really shouldn't be used that way.
Thats just a CSV with extra steps.
Nope, that's CSV without the drawbacks of CSV. That's CSV that can have special characters and doesn't suffer from delimiter problems.
When someone says "Maybe we can fix CSV" this is what you should do instead of trying to "fix" CSV.
Interesting. This is JSON++ somehow. What should it be called? Line-oriented JSON? Row-JSON?
It's just JSON. It's not an extension to the spec, it's a subset of the spec. If anything, you could say it's JSON--.
Well, to work as a CSV-like JSON, i.e greppable similar to a CSV it needs formatting with linebreaks as above. It is still completely valid JSON. ++ is the formatting convention.