/jdad

An extremely tiny Json parser in Javascript

Primary LanguageJavaScriptMIT LicenseMIT

JDAD

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!

Usage

# Parsing a file
node src/index.js test/twitter.json

# Benchmark against JSON.parse
node src/index.js test/twitter.json bench

Limitations

  • 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!