top | item 45724735

(no title)

HatchedLake721 | 4 months ago

https://jsonpath.com/ or https://jsonata.org/

discuss

order

wofo|4 months ago

Would you mind sharing a bit more? Have you used them? How did that go?

gnarlouse|4 months ago

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.