Incremental JSON parser for streaming LLM tool calls in Ruby
Built this for streaming AI tool calls. LLMs stream function arguments as JSON character-by-character. Most parsers reparse from scratch each time - O(n²) behavior that causes UI lag. This maintains parsing state, processing only new characters. True O(n) performance that stays imperceptible throughout the entire response. Ruby gem, MIT licensed. Would love feedback.
Incremental JSON parser for streaming LLM tool calls in Ruby launched on October 22, 2025 with 13 votes, #768 of 8,178 launches that month and more than 75% of that year's launches.
In plain words
This Ruby gem parses JSON incrementally as it arrives character-by-character from streaming language models, avoiding the performance bottleneck of reparsing entire documents. Instead of O(n²) complexity that causes UI lag, it maintains parsing state and processes only new characters for true O(n) performance. Built specifically for AI tool calls, it keeps interfaces responsive throughout long responses. The library is open-source under the MIT license.
written from the facts on this page · September 2026
From the sources
Modern LLM providers can stream their responses. This is great for user experience — instead of a loading spinner, users see the response being generated in real time. They can also call external functions (also called "tools"): search your database
Aha! Develop is the agile tool that links strategy to delivery . Modern LLM providers can stream their responses. This is great for user experience — instead of a loading spinner, users see the response being generated in real time. They can also call external functions (also called "tools"): search your database, run calculations, send emails, whatever you give them. When the AI decides to use a tool, it returns the function arguments as JSON. For example, {"query": "sales reports Q4"} . Except there's a catch. The tool arguments come through as JSON. And when you're streaming JSON character by character, most of those characters form ... incomplete JSON: {"user {"user": {"user":"ali…from aha.io
Does a similar job
all alternatives →
LLMs can generate valid JSON 100% of the time2023 · github.com · ▲854Outlines is a Python library that focuses on text generation with large language models. Brandon and I are not LLM experts and started the project a few months ago because we wanted to understand better how the generation process works. Our original background is probabilistic, relational and symbolic programming. Recently we came up with a fast way to generate text that matches a regex (https://blog.normalcomputing.ai/posts/2023-07-27-regex-guide...). The basic idea is simple: regular expressions have an equivalent Deterministic-Finite Automaton (DFA) representation. We…
Beyond text splitting – improved file parsing for LLMs2024 · github.com · ▲206Improved file parsing for LLM’s. Contribute to Filimoa/open-parse development by creating an account on GitHub.
A Fast, Malloc-Free C++14 Json Parser and Encoder2014 · github.com · ▲98Meta programming utilities for C++14. Merged in matt-42/lithium - matt-42/iod
Robust LLM extractor for websites in TypeScriptMar 2026 · github.com · ▲72We've been building data pipelines that scrape websites and extract structured data for a while now. If you've done this, you know the drill: you write CSS selectors, the site changes its layout, everything breaks at 2am, and you spend your morning rewriting parsers. LLMs seemed like the obvious fix — just throw the HTML at GPT and ask for JSON. Except in practice, it's more painful than that: - Raw HTML is full of nav bars, footers, and tracking junk that eats your token budget. A typical product page is 80% noise. - LLMs return malformed JSON more often than you'd expect, especially with…
Python JSON library in Rust, faster than ujson2018 · github.com · ▲40Fast, correct Python JSON library supporting dataclasses, datetimes, and numpy - ijl/orjson
uDSV.js – A faster CSV parser2023 · github.com · ▲67Hey folks! I know CSV parsers (especially in JS) aren't terribly exciting and someone writes a "better" one every week. I'm in the middle of my parental leave, and this was a project that came out of me looking for the fastest/smallest CSV parser. It all started so innocently, and then turned into a benchmark-validation-athon; the library itself took ~2 weeks to write, but the performance comparisons took another ~4 weeks (on and off). The benchmarks were a huge effort, but I think they are the most thorough to date, both in breadth and in depth, so hopefully you find them useful:…
More ai this month
the category →



Paintings by AI models: programs run through a simulation of oil paint.
AI · 21d ago · stillwet.art
PixVerse R2▲381A real-time world model you can explore and change
AI · 30d ago · world.pixverse.video

Source: Show HN post ↗
Launched alongside, October 2025
the whole month →


I went down the rabbit hole on a side project and ended up building this: Strange Attractors(https://blog.shashanktomar.com/posts/strange-attractors). It’s built with three.js. Working on it reminded me of the little "maths for fun" exercises I used to do while learning programming in early days. Just trying things out, getting fascinated and geeky, and being surprised by the results. I spent way too much time on this, but it was extreme fun. My favorite part: someone pointed me to the Simone Attractor on Threads. It is a 2D attractor and I asked GPT to extrapolate it to…
AI · Oct 2025 · blog.shashanktomar.com

Autism Simulator▲779Hey all, I built this. It’s not trying to capture every autistic experience (that’d be impossible). It’s based on my own lived experience as well as that of friends on the spectrum. I'm trying to give people a feel for what masking, decision fatigue, and burnout can look like day-to-day. That’s hard to explain in words, but easier to show through choices and stats. I'm not trying to "define autism". I’ve gotten good feedback here about resilience, meds, and difficulty tuning. I’ll keep tweaking it. If even a few people walk away thinking, "ah, maybe that’s why my coworker struggles in those…
Life & fun · 2025 · autism-simulator.vercel.app
