←back to thread

Show HN: JSON Query

(jsonquerylang.org)
147 points wofo | 1 comments | | HN request time: 0s | source

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?

Show context
cryptonector ◴[] No.45725897[source]
You just have to wrap your mind around jq. It's a) functional, b) has pervasive generators and backtracking. So when you write `.a[].b`, which is a lot like `(.a | .[] | .b)` what you get is three generators strung together in an `and_then` fashion: `.a`, then `.[]`, and then `.b`. And here `.a` generates exactly one value, as does `.b`, but `.[]` generates as many values as are in the value produced by `.a`. And obviously `.b` won't run at all if `.a` has no values, and `.b` will run for _each_ value of `.a[]`. Once you begin to see the generators and the backtracking then everything begins to make sense.
replies(1): >>45730894 #
1. movpasd ◴[] No.45730894[source]
I think this is a paradigm known as concatenative programming: https://en.wikipedia.org/wiki/Concatenative_programming_lang...