3 ms·
Typing isn't optional in JSON, every value has a concrete type, always.
by lgas 2y ago
Typing isn't optional in JSON, every value has a concrete type, always.
- gghffguhvc 2y ago[ [“header1”,”header2”], [“1.1”, “”], [7.4, “2022-01-04”] ]
- Sohcahtoa82 2y ago...and? I see an array of arrays. The first and second arrays have two strings each, the last one has a float and a string. All those types are concrete. Let's say those "1.1" and 7.4 values are supposed to be version strings. If your code is only sometimes putting quotes around the version string, the bug is in your code. You're outputting a float sometimes, but a string in others. Fix your shit. It's not your serialization format that's the problem. If you have "7.4" as a string, and your serialization library is saying "Huh, that looks like a float, I'm going to make it a float", then get a new library, because it has a bug.
- lelandbatey 2y agoTypes at the type layer are not the same as types at the semantic layer. Sure every type in the JSON level has a "strong type" but the semantic meaning of the contents of e.g. a string are usually not expressable in pure JSON. So it is with CSV; you can think of every cell in CSV as containing a string (series of bytes) with it being up to you to enforce the semantics atop those bytes. JSON gives you a couple extra types, and if you can fit things into those types well, then that's great, but for most data concrete semantically meaningful data you won't be able to do that and you'll end up in a similar world to CSVs.