An extremely tiny JSON parser written in Js to learn how recursive descent parsing works. The parser’s design is inspired by Monads and is just 34 SLOC!
# Parsing a file
node src/index.js test/twitter.json
# Benchmark against JSON.parse
node src/index.js test/twitter.json bench
- Extremely slow! 50-100 times slower than
JSON.parse
. - Does not show where a syntax error occurred. It just returns
null
when an invalid JSON is encountered. Does not unescape escape sequences.It does now!