Live data from Hacker News

Show HN: Transform a CSV into a JSON and vice versa

jsonmatic.com

41–50 of 111 posts

Re: Show HN: Transform a CSV into a JSON and vice versa

#41
post #34

Looks a bit like adware IMO. The library appears to be drenched in analytics. Dependencies include: https://www.npmjs.com/package/web-vitals/v/0.1.0 https://www.npmjs.com/package/@fingerprintjs/fingerprintjs Harvesting user's data, most likely...

There's nothing wrong with web-vitals...

There's nothing wrong with web-vitals, and it's included in create-react-app, which the author used.

Re: Show HN: Transform a CSV into a JSON and vice versa

#42
post #34

Looks a bit like adware IMO. The library appears to be drenched in analytics. Dependencies include: https://www.npmjs.com/package/web-vitals/v/0.1.0 https://www.npmjs.com/package/@fingerprintjs/fingerprintjs Harvesting user's data, most likely...

It looks like there is some confusion of what it is. The content you see in linked page is the the software not a demonstration of how the library output looks. If it was a library taking in bytes and outputting bytes I would agree that it shouldn't depend on any analytics, but if it's a website that's more of authors choice.

Re: Show HN: Transform a CSV into a JSON and vice versa

#43
post #17

Earlier quoted context omitted.

> CSV is more of a rumor than a standard This reminds me of something my boss at a previous job would say: "I am morally opposed to CSV." Why? Because we worked at an NLP company, where we would frequently have tabular data featuring commas, which means if we used CSV we'd have a lot of overhead involving quoting all our CSV data. Instead my boss preferred TSV (T = tab) as our preferred tabular data format, which was…

Lol, so instead of having an actually working solution (escaping), you had a still broken solution that just didn’t blow up as often so you could ignore it until it caused a crash.

Escaping breaks often as well. The general problem is that the data is inline with the format. Parquet files or something that has clear demarcation between data and file format are more ideal but probably nothing is perfect or future proof. Or accepting of past mistakes either.

Re: Show HN: Transform a CSV into a JSON and vice versa

#44
post #28

Earlier quoted context omitted.

This is the real answer. All of the other answers are suggesting various changes to the JSON structure to eliminate key repetition, but this is irrelevant under compression. Where it becomes relevant is if each record is stored as a separate document so you can't just compress them all together. Compressing each record separately won't eliminate the duplication, so you're better off with either a columnar format (lik…

To parse it, you need to check the keys. If there can’t be other keys, you can just use an array which is stable on JSON and you can save on keys. So you just have an array of arrays. Or even a huge array and every X elements, it’s a new record. If each one has 2 keys, [ { key1: ‘a’, key2: ‘b’ }, { key1: ‘a’, key2: ‘b’ } ] Can become, [ [ ‘a’, ‘b’ ], [ ‘a’, ‘b’ ] ] Or just every 2 will be a new record, [ ‘a’, ‘b’, ‘a…

But why? Why save on keys when compression will nearly eliminate them for you?

Re: Show HN: Transform a CSV into a JSON and vice versa

#45
post #34

Looks a bit like adware IMO. The library appears to be drenched in analytics. Dependencies include: https://www.npmjs.com/package/web-vitals/v/0.1.0 https://www.npmjs.com/package/@fingerprintjs/fingerprintjs Harvesting user's data, most likely...

There's nothing wrong with web-vitals...

But there is much wrong with finger printing.

Re: Show HN: Transform a CSV into a JSON and vice versa

#47
post #46

You should use outline instead of border in your cell css.

Why?

I read https://css-tricks.com/almanac/properties/o/outline/ and it says

> The outline property in CSS draws a line around the outside of an element. It’s similar to border except that:

> 1. It always goes around all the sides, you can’t specify particular sides

> 2. It’s not a part of the box model, so it won’t affect the position of the element or adjacent elements (nice for debugging!)

> […]

> It is often used for accessibility reasons, to emphasize a link when tabbed to without affecting positioning and in a different way than hover.

I guess this is why you said outline should be used instead in this case.

Re: Show HN: Transform a CSV into a JSON and vice versa

#49
post #34

Looks a bit like adware IMO. The library appears to be drenched in analytics. Dependencies include: https://www.npmjs.com/package/web-vitals/v/0.1.0 https://www.npmjs.com/package/@fingerprintjs/fingerprintjs Harvesting user's data, most likely...

Author here; some clarification. I use fingerprint to get the number of visits (instead of using something invasive like Google Analytics):

https://github.com/erikmartinjordan/jsonmatic/blob/master/sr...

I get the fingerprint as a UID (which is like a random number for me). I don't harvest any user's data. Code is open-source, you can verify what I'm saying if you wish.

Re: Show HN: Transform a CSV into a JSON and vice versa

#50

Earlier quoted context omitted.

A columnar structure is definitely popular in the analytics community, although there are binary formats that are faster to scan again and can be mmap'd for zero-copy access. The fundamental problem with CSV is that it has no canonical form or formal construction. Even the RFC documents it by example and historical reference, rather than from first principles, and does so with liberal use of "maybe". Consequently bei…

+1 - If you are looking for something JSON-compatible, JSON Lines (one json object per line - https://jsonlines.org/ ) is pretty popular as well. You could store a CSV in JSONL very easily. In fact, jsonlines' website shows it as its first example: https://jsonlines.org/examples/ And if you wanted something that is json file-wide, you can just add some commas and wrap in [] for a list of rows.

jsonlines (and ndjson too, since they're overlapping specs) is amazing. It's definitely the better way to convert between JSON and CSV.

  » ps aux | grep root | head -n5 | format jsonl
  ["root","87596","0.0","0.0","4359648","116","??","Ss","10:01am","0:00.02","com.apple.cmio.registerassistantservice"]
  ["root","81777","0.0","0.0","4321932","88","??","Ss","Wed12am","0:00.01","PlugInLibraryService"]
  ["root","71784","0.0","0.1","4365572","10504","??","Ss","Tue11pm","0:25.88","PerfPowerServices"]
  ["root","42906","0.0","0.0","4321572","88","??","Ss","Tue09am","0:00.01","com.apple.ColorSyncXPCAgent"]
  ["root","47415","0.0","0.0","4303172","88","??","Ss","Sat04am","0:00.01","aslmanager"]

It has the readability of CSV but the stricter formatting of JSON. Win win.
Post reply on HN