Skip to content
Tech Atlas, home
Search
Esc
  • All roadmapsBrowse every learning path
  • ExploreFind a technology area
  • ProjectsGuided projects and builds
  • My AtlasYour learning dashboard
Practice build · Languages, parsers and algorithms

Build your own JSON Parser

A JSON parser written by hand: a tokenizer, a recursive-descent parser, error messages with positions, and a round-trip test.

  • Intro
  • About 3–6 h
  • 4 checkpoints
  • 2 tutorials · Nim, Python

Pick a tutorial, then check yourself at each checkpoint. Work in any language you like.

Choose a tutorial

Why build it

Parsing turns text into structure, the first step of compilers, config loaders and APIs. JSON is the smallest real grammar to start with.

You will be able to

  • Tokenise input into strings, numbers, literals and punctuation.
  • Write a recursive-descent parser from a grammar.
  • Report errors with line and column.
  • Handle escapes and Unicode correctly.

Skills it exercises

Recommended on Data Structures & Algorithms.

Checkpoints

How you know you are there

Work in any language. Each checkpoint ends with something you can run or observe, so you can check it yourself.

  1. Checkpoint 1Self-check

    Tokenizer

    Done when: Every JSON token type is recognised, including escaped strings and exponents.

  2. Checkpoint 2Self-check

    Parser

    Done when: Nested objects and arrays parse into native values that equal the standard library's result on 20 sample files.

  3. Checkpoint 3Self-check

    Errors

    Done when: Invalid input such as trailing commas or unclosed strings fails with a message giving line and column.

  4. Checkpoint 4Self-check

    Conformance

    Done when: The parser passes the JSONTestSuite cases it claims to support, and serialising then parsing round-trips.

Stretch goals

  • A streaming parser for files larger than memory.
  • Parse another small format, such as INI or TOML.
Follow a tutorial

Step-by-step guides

Pick one in a language you know (tutorial languages: Nim, Python). They open on the author’s site.

Where to go next

Practice builds are self-paced: Tech Atlas does not track them or count them as evidence. To show a skill, take its knowledge check from the skill page.

Tutorials come from codecrafters-io/build-your-own-x (CC0, snapshot of 2026-07-14, commit aa17439; links checked on 2026-10-19). Each tutorial belongs to its author and keeps its own licence; Tech Atlas links to it and does not host it. Briefs, checkpoints and the mapping to skills are Tech Atlas editorial drafts.