Earlier quoted context omitted.
Yeah, lists of objects are pretty crap, because they're almost always homogeneous but unenforcédly so; it's not just a size issue but a parsing (or not - usage) issue too. You could approximate CSV in a JSON response like: { "columns": ["a", ..., "z"], "rows": [[1, ..., 26], ..., [11, 2266]] } Or: { "a": [1, ..., 11], ... "z": [26, ..., 2266] } which I've never seen, but would save space, and sort of enforced in the…
I’ll note, your second item here is a structure of arrays, which is often higher performance in practice when you are only interested in certain portions of the data. For this reason, your second structure is how I serialize code I’m interacting with in C.
Show HN: Transform a CSV into a JSON and vice versa
61–70 of 111 posts
Re: Show HN: Transform a CSV into a JSON and vice versa
#62Slightly OT: I've realized that CSVs are dramatically more information-dense than the equivalent JSON, and actually make a pretty reasonable API response format if your dataset is large and fits into the tabular shape. They can be a fraction of the size, mainly because keys aren't duplicated for every item.
Yeah, lists of objects are pretty crap, because they're almost always homogeneous but unenforcédly so; it's not just a size issue but a parsing (or not - usage) issue too. You could approximate CSV in a JSON response like: { "columns": ["a", ..., "z"], "rows": [[1, ..., 26], ..., [11, 2266]] } Or: { "a": [1, ..., 11], ... "z": [26, ..., 2266] } which I've never seen, but would save space, and sort of enforced in the…
We use JSON Schema heavily to enforce structure in JSON data. https://json-schema.org/
Re: Show HN: Transform a CSV into a JSON and vice versa
#63CSV is more of a rumor than a standard, plus JSON can have a tree structure. It is a fun idea to think about and may be useful in some narrow cases, but will fail in almost all but those most trivial of structures.
Re: Show HN: Transform a CSV into a JSON and vice versa
#64I'm sorry, but why is this a website?
And to educate! To show each other. To make knowledge discoverable. That’s the reason websites like this are honestly a very good thing.
Re: Show HN: Transform a CSV into a JSON and vice versa
#65Re: Show HN: Transform a CSV into a JSON and vice versa
#66Can this handle uploading csvs?
https://github.com/erikmartinjordan/jsonmatic/blob/525b7fbc9...
Re: Show HN: Transform a CSV into a JSON and vice versa
#67How do you actually load CSVs into it?
Re: Show HN: Transform a CSV into a JSON and vice versa
#68I'm sorry, but why is this a website?
So that we may have this discussion and get out of this strange rut that is the care and feeding of idempotent little formats. And to educate! To show each other. To make knowledge discoverable. That’s the reason websites like this are honestly a very good thing.
Re: Show HN: Transform a CSV into a JSON and vice versa
#69Wouldn't this need to allow upload/download of CSV to really meet the spirit of the title? Or maybe replace the references of CSV with "HTML Table"?
Re: Show HN: Transform a CSV into a JSON and vice versa
#70Earlier quoted context omitted.
Shouldn’t really matter too much if the response is being compressed. If you’re rendering the table in the DOM, the response size is the least of your issues.
Sometimes you fetch a large dataset and only show one page at a time in the DOM, or render it as a line in a chart or something. At a previous workplace we had CSV responses in the hundreds of megabytes.