Extension JSONata 1.0.0.1-SNAPSHOT

Query and transform JSON data using JSONata expressions - like XPath/XQuery but for JSON.

Working with JSON can be a bit manual, using elvis and the safe navigation operator help for simple use cases, but as developer, life could be easier right?

Introducing JSONata

data = {
    products: [
        { name: "apple", price: 1.50 },
        { name: "banana", price: 0.75 },
        { name: "cherry", price: 3.00 }
    ]
};

// Filter by condition
JSONata( "products[price > 1].name", data )  // ["apple", "cherry"]

// First match
JSONata( "products[price < 1]", data )  // { name: "banana", price: 0.75 }

Requires Lucee 7.0.2 or newer

9 Likes

That’s a pretty cool idea. I know that I’ve definitely had use of XPath from time to time over the years. I could see this being useful as well.

1 Like

Any plan to back port it to Lucee@6?

nah, sorry, there are changes in Lucee 7 to support our new maven based extensions approach

It’s time to upgrade, all the fun new stuff will be using this approach.

There’s a great new PDF update coming which requires 7.1+, which is also another huge performance update for Lucee :slight_smile:, 6.2 is a little old Vespa in comparison to 7.1!

2 Likes