We rewrote JSONata with AI in a day, saved $500k/year
TL;DR Highlight
Feeding JSONata's test suite to AI produced a Go rewrite and saved $500K/year
Who Should Read
Backend developers worried about infrastructure costs from calling services in another language over RPC
Core Mechanics
- The RPC boundary drove the cost
- A Go pipeline called Node.js jsonata-js pods over RPC.
- Every event was serialized, sent, evaluated, and serialized back, costing about $300K/year.
- The RPC round trip alone was about 150 microseconds before evaluation.
- The official tests were the AI's target
- Following Cloudflare's Next.js rewrite, they ported the official jsonata-js tests to Go.
- AI implemented the evaluator until all tests passed.
- The result was 13,000 lines of Go, 1,778 passing tests, about 7 hours, and $400 in tokens.
- Expressions run on two tiers
- Simple expressions evaluate on raw bytes without parsing the whole JSON.
- Everything else goes through a full parser and evaluator, parsing only the needed subtrees.
- Simple lookups are up to 1,000x faster than the RPC path, and complex ones 25-90x faster.
- Shadow mode made the switch safe
- gnata evaluated everything while jsonata-js results were still used.
- Mismatches were logged and alerted, and edge cases were fixed.
- After three straight days of zero mismatches, gnata became primary.
- Batching saved another $200K
- JSONata evaluates one at a time, so the rule engine spun up tens of thousands of goroutines.
- They rebuilt the rule engine internals as micro-batches on top of gnata.
- That cut about $18K/month, roughly $200K/year.
Community Reactions
- Why not use existing Go libraries
- Several commenters said two Go implementations already existed and wondered why a new one was built.
- One said without benchmarking against them you can't know if the AI version is faster.
- Maintenance burden
- Commenters noted the team now owns about 13k lines of Go forked-style code and must track upstream changes.
- Another worried AI-written functions may hide bugs without tests.
- Experience with an AI Go port
- One commenter used Claude Code and Codex in early 2025 to build a fully test-passing JSONata Go port now running in production.
- They said JS-derived syntax nuances made it nontrivial for AI.
- The real issue was architecture
- Many said leaving a $300K/year RPC setup in place was the problem, not something AI solved.
- Some said a human could have ported it by hand in about a week.
How to Apply
- Measure your cross-language RPC costs
- Today, pick a spot where you call another-language service over RPC and measure per-call latency and pod count.
- If serialization and network dominate short computations, list it as a candidate for embedding a library.
- Compare existing libraries before rewriting
- Find existing implementations in your target language and tabulate test pass rates and maintenance status.
- Run isolated benchmarks on the same inputs against your own build.
- Use the official tests as AI's stop condition
- Port the upstream test suite to your language first.
- Tell the AI to implement until all tests pass, and record the pass count in the PR.
- Validate the swap in shadow mode
- Keep using the old implementation's results while running the new one in parallel.
- Log and alert mismatches, and promote after several consecutive days of zero.
Try It
# Paste into Claude Code or ChatGPT (simplified version of the article's method)
Our service is written in {{language A}} and calls the {{language B}} library {{library name}} over RPC.
Follow these steps.
1. Analyze the official test suite structure of {{library name}} and plan the port to {{language A}} in waves.
2. Port the tests to {{language A}} first.
3. Implement until all tests pass, reporting pass counts and the failure list each time.
4. Propose a design with a fast path for simple cases and a full path for the rest.
5. Add shadow-mode code that compares results with the existing implementation and logs mismatches.
{{requirements and constraints}}Terminology
Related Papers
A Beginner's Guide to Local AI with Inkling, Qwen, and Unsloth
Install Unsloth Desktop, load a quantized Qwen model, and share a private ChatGPT-like AI on your home LAN.
Muru – AI-assisted Rust server for Python apps by mod_WSGI's creator
mod_wsgi's creator is building Muru, an AI-assisted Rust ASGI/WSGI server, documenting it in public
87% of the Anthropic power will come from gas and 11% from coal in 2028
Analysis of Anthropic's contracted data centers: 87% gas, 11% coal power in 2028
Anthropic’s Nasdaq debut
Anthropic listed on Nasdaq and closed its first day below its opening price.
OpenAI still has a WebRTC Problem
WebRTC drops late audio, hurting voice AI; MoQ retransmits and buffers instead
Gemini 4 Neon
Gemini 4 Neon cuts cost per task 32% versus Carbon, at $3 input and $15 output per million tokens
AI is killing All About Berlin
After Google AI Overviews, a Berlin guide site lost 70-75% of its traffic.
Not Everything Needs an LLM
PostHog used small decision models to skip 98.7% of expensive LLM calls