4 ms·
> This project would not have been possible without itchyny's jq implementation gojq. Another approach is to take the convert binary to object part of your cod
by lido 5y ago
> This project would not have been possible without itchyny's jq implementation gojq.
Another approach is to take the convert binary to object part of your code, output that as JSON on stdout and feed that into jq.
Basically, a binary front end + jq = fq
- jrockway 5y agoI wrote a small script to convert CSVs to JSON strictly to use jq on the output. Querying things like your GCP bill with jq is quite enjoyable. gojq is also nice. I work with a lot of structured logs and wrapped jq with a little bit of format-understanding and output sugar to make looking at and analyzing such logs an enjoyable experience: https://github.com/jrockway/json-logs https://github.com/jrockway/json-logs
- darrenf 5y ago> I wrote a small script to convert CSVs to JSON strictly to use jq on the output Note that you can use jq to consume simple CSVs (and produce them) without anything else. There’s an entry in the cookbook wiki https://github.com/stedolan/jq/wiki/Cookbook#convert-a-csv-file-with-headers-to-json https://github.com/stedolan/jq/wiki/Cookbook#convert-a-csv-f... - I posted some usage examples a few months back https://news.ycombinator.com/item?id=27379423 https://news.ycombinator.com/item?id=27379423
- awild 5y agoMiller Csv can process json in record format and has a much saner DSL in my experience. https://github.com/johnkerl/miller https://github.com/johnkerl/miller
- donio 5y agoIt would be hard to get the full fq functionality that way. How would you encode the data in a way so that you can do both: .frames[100].header.sample_rate for the individual field and .frames[100].header|tobytes[:0x10] for the first few bytes of the entire header structure? Or decode a binary slice as a particular format: tobytes[0x234:0x325]|avc_sps.max_num_ref_frames
- cglong 5y agoI wish this was only the binary front end so I could pick my parser (e.g. PowerShell). I see fq seems to support sending the whole JSON to stdout; I wonder if there's a way to make this the default behavior: # JSON for whole file fq tovalue file
- wwader 5y agoHi, i wrote a bit about this in my reply above https://news.ycombinator.com/item?id=29661575 https://news.ycombinator.com/item?id=29661575