ManuelGarcia

ManuelGarcia

Hi everyone!

I originally started using JSONata for a few dynamic JSON evaluations in pipelines at work. The expressions were useful, but the supporting code gradually grew beyond those initial cases. I organized it into a standalone Elixir library, added tests and documentation, and published it in case it helps someone with a similar problem.

Jexata compiles JSONata expressions and evaluates them against Elixir maps and lists. A small example:

data = %{
  "orders" => [
    %{"product" => "Book", "price" => 20},
    %{"product" => "Pen", "price" => 30}
  ]
}

{:ok, 50} = Jexata.run("$sum(orders.price)", data)

For expressions used repeatedly, you can compile once and evaluate them against different documents.

Version 1.0.0 supports paths, predicates, grouping, sorting, higher-order functions, regex, date and number formatting, and immutable transforms. It also offers bounded evaluation for expressions supplied by users, with configurable time and resource limits.

Why I built it

My use case was transforming data that was already in memory: JSON payloads moving through pipelines, where the expression could vary without changing the Elixir code around it. I wanted a reusable way to select fields, filter records, aggregate values, and build new documents.

Jexata is written in Elixir and does not need a JavaScript runtime in production. It also works alongside tools such as Ecto: I would still use the database to filter or aggregate large tables, then use Jexata when I need to transform the resulting document.

Compatibility and performance

I tested version 1.0.0 against the JSONata.js v2.2.0 reference suite: 1,676 of 1,679 cases pass. The three remaining differences involve the order of keys in input objects, since native Elixir maps do not retain JSON source order. I’ve documented that limitation rather than presenting the library as a perfect drop-in replacement.

I also compared 64 expressions with JSONata.js, checking results before comparing timings. Results matched for 63 expressions; on that recorded Apple Silicon run, Jexata had a lower median time in 61 of those 63. For example, filtering 1,000 orders took about 109 µs with Jexata and 791 µs with JSONata.js in that benchmark. These are measurements of the public APIs on one machine, not a general performance guarantee; short JavaScript evaluations also include its async API cost.

Try it

defp deps do
  [{:jexata, "~> 1.0"}]
end

This began as a practical tool for my own pipelines. I’d love to hear whether it fits any of your use cases, and especially where the API or documentation could be clearer.

You can find the package on Hex. The benchmark report includes the exact workloads, timing ranges, and methodology. The README in the repository has more examples, from simple paths to larger transformations.

Where Next? Top

Trending in Announcing Top

mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
kip
Localize is the next generation localisation library for Elixir. Think of it as ex_cldr version 3.0. The first version will be released ...
New
quatermain
Hello, I’m sharing my plugin here in forum after some time so it has time to mature and proof yourself. I use Claude Code daily on a pr...
New
gtcode
Aloha gang, There’s a new class of AI model out from TypeSafe. Jev is their flagship model. You can learn about it here: ...
New
LostKobrakai
I’ve recently created a small library phoenix_vite integrating the vite build tooling with phoenix. It provides an igniter.installer t...
New
danschultzer
I needed something like premailer for rails, and after searching, I decided to make an easy-to-use library to handle inline styles and co...
New
kraleppa
If you’ve ever had to debug a BEAM node you know it can be a painful process. Parsing raw data, or dealing with clutter often gets in the...
New

Other Trending Topics Top

dominicletz
Hey there, I haven’t seen a list of useful Elixir specific skills for the popular AI tools yet so I’m starting one here with my first. ...
New
raa-ziq
Hi everyone :waving_hand: I wanted to share something I’ve been building — NowBlind, a random chat app designed to help people discover ...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
OndrejValenta
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly) AI dream has many faces, but general...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
CodeSync
Code BEAM Europe 2026 – Call for Talks is Open! We’re excited to announce that Code BEAM Europe 2026 is now open for talk submissions :t...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews