3 ms·
Right - the JSON-newline equivalent of CSV can look like this: ["id", "species", "nickname"] [1, "Chicken", "Chunky cheesecakes"] [2, "Dog", "Waggi
by simonw 2y ago
Right - the JSON-newline equivalent of CSV can look like this:
["id", "species", "nickname"]
[1, "Chicken", "Chunky cheesecakes"]
[2, "Dog", "Wagging wonders"]
[3, "Bunny", "Hopping heroes"]
[4, "Bat", "Soaring shadows"]
- nomel 2y agoRemove the [] characters and you've invented CSV with excel style quoting.
- simonw 2y agoAlmost, except the way Excel-style quoting works with newlines sucks - you end up with rows that span multiple lines, so you can't split on newline to get individual rows. With JSON those new lines are \n characters which are much easier to work with.
- magicalhippo 2y agoI ended up parsing the XML format instead of the CSV format when handling paste from Excel due to the newlines issue. CSV seemed so simple but after numerous issues, a cell with both newline and " made me realize I should keep the little hair I had left and put in the work to parse the XML. It's not great either, with all its weird tags, but at least it's possible to parse reliably.
- freehorse 2y agoThis misses the point of standardization imo because it’s not possible to know a priori that the first line represents the variable names, that all the rows are supposed to have the same number of elements and in general that this is supposed to represent a table. An arbitrary parser or person wouldn’t know to guess since it's not standard or expected. Of course it would be parsed fine but the default result would be a kind of structure or multi-array rather than tabular.
- afiori 2y agoapplication/jsonl+table
- collinmanderson 2y agoThis is the way. jsonl where each row is a json list. It has well-defined standard quoting. Just like csv you don't actually need the header row either, as long as there's convention about field ordering. Similar to proto bufs, where the field names are not included in the file itself.