My problem is the infrequency with which I need to use jq means I don't create a good learning feedback loop. The last time I used it though, I was able to walk down a decently complicated structure (indexed val in an array in a key in a hash in an array) and extract the data I wanted only having to google once. Like awk, though, I know there's a world of functionality I'm just not using.
Some collection of typical problems and solutions would help I guess.
The IMO not so good parts of that page are
- Quite a few section headers don’t make sense to novices
- I think the table of contents would be better if it had subheaders, ideally with one-line descriptions of the features (that probably would solve the issue above)
- not every section has examples
- some examples use fairly advanced features, making them harder to understand then necessary
I tried, more than once, but I guess I'm not smart enough.
- jello (PyPI) - yamlpath (PyPI) - dasel
def gron:
( path(..) as $p
| getpath($p)
| scalars
| "\($p | path_to_expr) = \(tojson)"
| println
);
Ex: $ fq gron <<< '{"a": [1,2,{"b": 3}]}'
.a[0] = 1
.a[1] = 2
.a[2].b = 3
Great for copy/paste into other expressions when poking around.