3 ms·
gojq works great with YAML and reimplements jq itself in Go. I use gojq with --yaml-input or --yaml-output (or sometimes both) and flip back and forth between J
by theonemind 4y ago
gojq works great with YAML and reimplements jq itself in Go. I use gojq with --yaml-input or --yaml-output (or sometimes both) and flip back and forth between JSON and YAML promiscuously and have 100% jq UI compat, which helps because I use jq a lot. First thing I looked at on yq is '-s', which is 'slurp' for jq, but different for yq. Slightly altered semantics would just trip me up, and it seems like you can make a nearly straight bijection between YAML and JSON so you can just do exactly the same things with either one (with some minor exceptions.)
https://github.com/itchyny/gojq https://github.com/itchyny/gojq
- 0cf8612b2e1e 4y agogojq does not preserve key order or offer option to sort keys. Which is a non-starter for me. The majority of my jq use is to cleanup API responses for easier human review.
- karmakaze 4y agoThey should be feature requests to gojq. There must be libraries for maps with sorted keys or preserving insertion order to use in place of the std 'map'.
- tenken 4y agoyup. this. It's portable! ... But nerfed.
- quinncom 4y agoYou might enjoy the httpie cli, which is better than curl for testing APIs for many reasons, one of which is automatic pretty printed and colorized text response output. https://httpie.io/cli https://httpie.io/cli
- pokstad 4y agoI believe gojq is also bundled with Benthos. Benthos is a great Swiss army CLI tool for various data manipulations.
- filereaper 4y agoyq has a merge function that gojq does not. We use both tools equally where ease of use is the primary driving factor.