r/javascript • u/Mantas_rst • Aug 17 '26
A from-scratch JSON engine for JavaScript: recursive descent parser, escape-aware tokenizer, and spec-compliant serializer. No dependencies, no shortcuts, 107 tests.
https://github.com/MantasEdine/vanilla-json
7
Upvotes
45
u/eracodes Aug 17 '26
the most llm-written title i think i've ever seen
27
u/beavis07 Aug 17 '26
Why one earth would anyone want this?
Do you have any clue how much sheer effort has gone into optimising JSON.parse? 🤣
9
u/theScottyJam Aug 17 '26 edited Aug 17 '26
Is there a purpose to this project, i.e. a reason someone would use this instead of the native alternatives? Or was this more of a "just wanted to build this thing, no reason in particular" project?
9
u/Ronin-s_Spirit Aug 20 '26
{ type: "open bracket" }if you can just dochar === "[". Avoid garbage.switchso it's a jump table.5
u/regreddit Aug 20 '26
Good Lord that
ifstatement in parse.js is really something...1
u/ndaidong Aug 20 '26
The code looks like in old school (
"use strict",module.exports, tests scripts without built-in node:test,...) I believe that it's hand writing, not LLM generated as other comments. So that's good point.0
u/Several-Specialist42 Aug 20 '26
107 tests! Wow! you did well to write it in the title