by labelbias · 6y ago · 0 comments
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.
In a future post, I'll cover how to use jq not just for json and xml but any data format.