5 ms·
As long as it is text-based. At least you can actually look at a CSV and see what is going (wrong), as well as use all the text tools we have. Not that there ar
by podiki 5y ago
As long as it is text-based. At least you can actually look at a CSV and see what is going (wrong), as well as use all the text tools we have. Not that there aren't problems as the article points out. But some binary file based on the whims of a proprietary program...no thanks.
- nolok 5y agoXlsx (office format for almost a decade now) are zip and XML all the way. Not fun to look at, but totally readable by a human.
- dullgiulio 5y agoReadable but not comprehensible. CSV is hard to beat in that sense, being somewhat "natural" like a table written on paper.
- daxuak 5y agoHuman 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.
- cogman10 5y agoAs 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.
- shapefrog 5y agoThats just a CSV with extra steps.
- cogman10 5y agoNope, 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.
- mongol 5y agoInteresting. This is JSON++ somehow. What should it be called? Line-oriented JSON? Row-JSON?
- cogman10 5y agoIt'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--.
- mongol 5y agoWell, 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.
- cogman10 5y agoGotcha. Yeah, it's never really come up as it's generally trivial to convert into this format from either a text editor or sed (Look for the `],[` and put a new line after the comma).
- deleted 5y ago[deleted]
- daxuak 5y agoLate 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.
- throwawayswede 5y agoAlso it's way more difficult to parse than CSV. I'm not saying that CSV is better (or worse), just that to each it's job! Wtf is this about retiring a format because it doesn't fit someone's expectation!
- cogman10 5y agoJSON and XML both make it easy to see what is going wrong and don't have near the same amount of drawbacks that CSV has.
- Semaphor 5y agoBoth are also not a good fit for columnar data at all.
- cogman10 5y agoI disagree. Json, in particular, can be nearly as compact as CSV by storing the data as an array of arrays. [[1,2,3], [4,5,6]] It's easy to make a structured data interchange format mimic and unstructured format. It's impossible to go the other way around without severe problems.
- bluedino 5y agoExcept that won't open in Excel
- cogman10 5y agoCorrect. That'd be a moving goalpost. The original claim was that JSON doesn't work well with columnar data. If the primary usecase is to take data give it to a non-programmer to evaluate it, then CSV isn't terrible. Add a transformer that's ran when someone manually requests to see the data. However, for machine to machine communication, CSV should never be used.
- WorldMaker 5y agoExcel actually has really good JSON import… it's just "hidden" in the Data tab on the ribbon and users don't want to learn how to use it. I feel so much of what keeps CSV in use is that it's a format that you can relatively easily generate without pulling in a lot of library dependencies and relatively quickly generate something that users can just "double click it opens in Excel". What the Excel team could really gift to developer humanity at this point is some dumb file extension Excel registers like XLJSON that you could just rename a JSON file to and Excel opens it like a spreadsheet on double click.