jq - lesson N - the N'd game
After all your learnings and this series, we’re trying to get to understand and write jq like the one below. It’s a culmination of our learnings:
jq 'def dotkeys:
def stringify: map(tostring) | join(".");
. as $in
| reduce paths(scalars) as $p (null;
($in|getpath($p)) as $v
| setpath([$p|stringify]; $v));
def chain(key):
.[key] |= dotkeys ;
chain("AParticularNestedKey")'
Yup, this looks terrible to me. Guess there’s a lot I need to learn here! So I’m on a quest and hopefully this’ll make more sense as these lessons progress.
But we’re not there yet.
Thanks @doug for this little bit of chicken-scratch.
Last modified on 2020-05-05