Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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 see. The need to quote JSON values and the need for @ seem like a high price to pay for removing the . in field accesses.

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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: