6 ms·
> CSV files.... that encode JSON?! We need a new schema language with the ability to specify such cross-format …formats.
by layer8 5y ago
> CSV files.... that encode JSON?!
We need a new schema language with the ability to specify such cross-format …formats.
- hnlmorg 5y agoI use jsonlines on those occasions https://jsonlines.org/examples/ https://jsonlines.org/examples/
- alcover 5y agoThis is nice. But less space-efficient than CSV when its strictly tabular, since CSV has columns legend on first row allowing 'pure' rows, whereas JSON will have to key every field, on every row.
- severak_cz 5y agoyou can have json lines where each line is json array
- hnlmorg 5y agoYour use case is literally the first item in the link I shared (and the reason I shared that link too): ["Name", "Session", "Score", "Completed"] ["Gilbert", "2013", 24, true] ["Alexa", "2013", 29, true] ["May", "2012B", 14, false] ["Deloise", "2012A", 19, true]
- karteum 5y agoI don't understand why people keep using CSV today while SQLite is MIT-licenced and can be used everywhere, has a very portable and lightweight implementation, has a stable file format with long-term commitment, and a good compromise on the type system that gives enough flexibility to be on par with CSV if some entries happen to have a different type...
- genericacct 5y agoInstalled base. You can bet there are thousands of AS/400s and similar architectures putting out CSVs. Also you cant get more lightweight than CSV, i have several microcontroller projects that output CSV.
- mason55 5y agoAre you suggesting sending around SQLite dbs as a data interchange format? Or to replace some other csv use case?
- karteum 5y agoYes exactly. As a data interchange format I think it is much better than CSV (more compact, faster, more efficient, less error-prone, etc.)
- martin_a 5y agoSwitch from the developer world to the business world and everybody has Excel to open the CSV files with the article information, the sales numbers and so on and can work with that. How do you even read data from SQLite to Excel? VBA? Some obscure connector? With CSV it's "import" or even "open file".
- hnlmorg 5y agoIronically Excels implementation of CSV is terrible. It’s constantly destroying data (eg large numeric and pseudo-numeric fields) not to mention the whole issue around any cell bringing with an equal symbol being converted into a function.
- jhgb 5y agoThat's like a file with S-expressions, only worse (because those already existed, whereas this had to be made up as a new thing, without offering any improvement).
- newaccount74 5y agoJSON lines has a few nice properties. The biggest advantage is that 1 line = 1 record, so you can use unix tools like head, tail, grep, sed to work on it. It's also easy to sync state in case of errors, since a newline always means record boundary. In CSV and normal JSON a record can span multiple lines,which sucks, so you almost always have to write custom code to work on them.
- jhgb 5y agoAn S-expression file with a newline after each top-level expression has the same property. So that's not really a problem.
- mst 5y agoClojure's EDN is pretty decent for this. ingy and I came up with p3rl.org/JSONY as a "JSON with less ceremony" compromise that I often find useful (it has a PEG grammar that's a superset of JSON so pretty easy to re-implement elsewhere)
- hnlmorg 5y agoThe hyphen prefixed arrays are very weird. It looks like YAML but behaves differently. Doesn’t help that YAML is also a superset of JSON too. I also don’t like space (char 32) used as a field delimiter because that opens up entire categories of bugs that are already a daily annoyance for shell scripting. I respect your thought processes but I can see this particular specification being more confusing than productive to most other people.
- mst 5y ago
- tecleandor 5y agoIBM has that JSONx that's... awful? https://www.ibm.com/docs/en/datapower-gateway/10.0.1?topic=20-jsonx https://www.ibm.com/docs/en/datapower-gateway/10.0.1?topic=2...