Live data from Hacker News

Faster and simpler with the command line: deep-comparing JSON files with jq

genius.engineering

91–93 of 93 posts

Re: Faster and simpler with the command line: deep-comparing JSON files with jq

#91
post #18

Earlier quoted context omitted.

CSV is hardly an easy format to parse, or really produce. There is no CSV standard, and I bet lyrics contain all kinds of weird characters that makes choosing a separator hard. Newline JSON is a fine interchange format for this, and the only advantage I can see for CSV is you can load it into a database in one command. Which begs the question as to why use a database at all for a simple one-off diff, when there are m…

Oh, I see: you probably didn't know that CSV formats is also means character separated values, and can actually use non-printing ASCII characters as delimiters. You didn't think I actually meant commas did you? I guess your experience with character separated value files is very limited. But my point was to illustrate if record fields are consistent you don't need a heavyweight solution like JSON... and you clearly m…

Did you really manage to turn CSV files into a flamewar topic?

Please review https://news.ycombinator.com/newsguidelines.html and avoid turning nasty in arguments on Hacker News.

Re: Faster and simpler with the command line: deep-comparing JSON files with jq

#92

Just a heads up to anyone using jq - I've previously spent a couple of hours debugging a problem because jq uses float64 to store integers (which might lead to rounding-errors/overflows). For example: echo 1152921504606846976 | jq 1152921504606847000

This is an artifact of JavaScript, which even as of ES6 uses IEEE 754 double-precision floats for all numeric values. jq likely uses the same implementation internally for compatibility reasons and to avoid surprises of a different kind. See https://www.ecma-international.org/ecma-262/6.0/#sec-ecmascr...

BigInt in top browsers now, not under a flag. Just sayin'!

https://brendaneich.com/wp-content/uploads/2017/12/dotJS-201... et seq.

Re: Faster and simpler with the command line: deep-comparing JSON files with jq

#93

Earlier quoted context omitted.

jq is a C program, yes, but jq programs are interpreted. Because jq is a dynamically-typed language, it wouldn't be easy to compile it to object code that would run too much faster than the byte-interpreted version (though it would still run faster). As you say, jq's power is that it is an expressive language, and it's much much easier to write jq programs that work than it is to write C/C++ programs as needed that d…

The interpreted language is just the setup phase for a pipeline of compiled-in data transformations.

I don't understand this statement. Keep in mind I'm a jq maintainer.
Post reply on HN