Build your own JSON parser

Read the language every web app speaks, one character at a time.

Every browser, phone app and server parses JSON millions of times a day. JSON.parse in JavaScript and json.loads in Python are exactly this.

About 90 minutes across 6 stages. Skills: Recursion, Parsing, State machines, Edge cases.

The guides are part of licode Club.

Stages

  1. Accept exactly {} (with optional whitespace).
  2. Parse "key": "value" pairs separated by commas.
  3. Values can be numbers, true, false or null.
  4. Arrays, and nesting to any depth.
  5. Handle escapes and reject sneaky invalid input.
  6. Print the minified document.