Most active commenters

    ←back to thread

    Show HN: JSON Query

    (jsonquerylang.org)
    147 points wofo | 14 comments | | HN request time: 0.306s | source | bottom

    I'm working on a tool that will probably involve querying JSON documents and I'm asking myself how to expose that functionality to my users.

    I like the power of `jq` and the fact that LLMs are proficient at it, but I find it right out impossible to come up with the right `jq` incantations myself. Has anyone here been in a similar situation? Which tool / language did you end up exposing to your users?

    1. lenkite ◴[] No.45724301[source]
    There are a ridiculous number of JSON query/path languages. Wish all the authors got together and harmonized on a standard.
    replies(5): >>45724358 #>>45724359 #>>45724472 #>>45724791 #>>45724843 #
    2. nartho ◴[] No.45724358[source]
    Plus, I feel like most, if not all, higher level languages already come with everything you need to do that easily. Well except for go that requires you to create your own filter function.
    3. miohtama ◴[] No.45724359[source]
    Xkcd.gif
    4. thayne ◴[] No.45724472[source]
    There is a standard in RFC 9535 (JSONPath)[1]. But as far as I can tell, it isn't very widely used, and it has more limited functionality than some of the alternatives.

    [1]: https://datatracker.ietf.org/doc/html/rfc9535

    replies(3): >>45724586 #>>45724870 #>>45725969 #
    5. NewJazz ◴[] No.45724586[source]
    Postgresql supports jsonpath, right?
    replies(1): >>45724708 #
    6. Groxx ◴[] No.45724708{3}[source]
    SQLite might too, though I'm struggling to find anything explicit about the syntax: https://sqlite.org/json1.html#jptr

    it might just be a very limited subset?

    replies(1): >>45726618 #
    7. voidfunc ◴[] No.45724791[source]
    The standard is called jq, any new standard is just going to be a committee circle jerk that doesn't move the ball forward in any meaningful way.
    replies(1): >>45725294 #
    8. cmckn ◴[] No.45724843[source]
    The AWS CLI supports JMESPath (https://jmespath.org) for the `--query` flag. I don't think I've run into anything else that uses it. Pretty similar to JSONPath IIRC.
    replies(1): >>45725086 #
    9. lelandbatey ◴[] No.45724870[source]
    Don't forget the also standardized way of referring to a single value in JSON, "JSON Pointer": datatracker.ietf.org/doc/html/rfc6901
    10. gegtik ◴[] No.45725086[source]
    azure tools also support JMESPath
    11. lenkite ◴[] No.45725294[source]
    jq is good but its syntax is strangely unmemorizable. Have used it for a decade and always need to look at the manual or at examples to refresh my knowledge.
    12. phpnode ◴[] No.45725969[source]
    the issue with JSONPath is that it took 17 years for it to become a properly fleshed-out standard. The original idea came from a 2007 blog post [0], which was then extended and implemented subtly differently dozens of times, with the result that almost every JSON Path implementation out there is incompatible with the others.

    [0] https://goessner.net/articles/JsonPath/

    13. NewJazz ◴[] No.45726618{4}[source]
    Looks like "JSON Pointer": datatracker.ietf.org/doc/html/rfc6901
    replies(1): >>45734485 #
    14. thayne ◴[] No.45734485{5}[source]
    JSON pointer uses very different syntax. Sqlite looks like it uses something that is very similar to, but not quite compatible with, JSONPath.