|
|
|
|
|
by mdaniel
1521 days ago
|
|
I dunno how to speak to your "computer science" part, but pragmatically anything that requires a "backreference", because unlike with JSONPath (and, of course, jq) there are no "root object" references $ printf '{"a": {"b":"c", "d":["d0","d1"]}}' | jq -r '[ .a as $a | $a.d[] | {x: ., y: $a.b}]'
[
{
"x": "d0",
"y": "c"
},
{
"x": "d1",
"y": "c"
}
]
and I realize this isn't as pure CS-y as you were asking, but this syntax is hell on quoting $ printf '["a","b"]' | jp -u 'join(`"\n"`, @)'
# vs
$ printf '["a","b"]' | jq -r 'join("\n")'
|
|
I also find jq more intuitive but I really dislike that we have three standards each used by a number of tools, e.g. jsonpath, jmespath, and jq.