Re:Mastering Jq: Part 1
by code-faster on Wednesday July 01, 2020 @07:33AM
(#23700313)
Nice! I've found xml transforms is one of the best applications of jq (yes, jq, not xq).
In a future post, I'll cover how to use jq not just for json and xml but any data format.
I love how nested lists inside objects can expand into a particular one with the .[] operator.
For example:
{ a: [{b: 5}, {b: 3}], c: 5} can be transformed into: [{ b: 5, c: 5}, {b: 3, c: 5}] using jq '{c: .c, b: .a[].b}'
For heavily nested XMLs I can get a nice flat output.