←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
HatchedLake721 ◴[] No.45724735[source]
https://jsonpath.com/ or https://jsonata.org/
replies(1): >>45724751 #
wofo ◴[] No.45724751[source]
Would you mind sharing a bit more? Have you used them? How did that go?
replies(1): >>45724947 #
gnarlouse ◴[] No.45724947[source]
I use `jsonata` currently at work. I think it's excellent. There's even a limited-functionality rustlib (https://github.com/Stedi/jsonata-rs). What I particularly like about `jsonata` is its support for variables, they're super useful in a pinch when a pure expression becomes ugly or unwieldy or redundant. It also lets you "bring your own functions", which lets you do things like:

``` $sum($myArrayExtractor($.context)) ```

where `$myArrayExtractor` is your custom code.

---

Re: "how did it go"

We had a situation where we needed to generate EDI from json objects, which routinely required us to make small tweaks to data, combine data, loop over data, etc. JSONata provided a backend framework for data transformations that reduced the scope and complexity of the project drastically.

I think JSONata is an excellent fit for situations where companies need to do data transforms, for example when it's for the sake of integrations from 3rd-party sources; all the data is there, it just needs to be mapped. Instead of having potentially buggy code as integration, you can have a pseudo-declarative jsonata spec that describes the transform for each integration source, and then just keep a single unified "JSONata runner" as the integration handler.

replies(2): >>45725158 #>>45730407 #
1. montekristooGDB ◴[] No.45730407{3}[source]
I confirm. At first I was trying to write that "buggy" code, until I got jsonata, and started working with the queries it supports.

It made my life a lot easier