JSON Parser
Built-from-scratch JSON parser in Python with RFC 8259 compliance, line/column error reporting, and a live demo.
Project Overview
JSON Parser is a Python project built from scratch to understand how JSON is processed internally — from scanning raw characters to validating structure and producing precise error messages. It follows the JSON standard (RFC 8259) and focuses on correctness, clarity, and defensive parsing.
What this project demonstrates:
Parser implementation — a custom tokenizer (scanner) and a recursive descent parser that validates and builds nested structures
Working with specifications — implementing core JSON types (objects, arrays, strings, numbers, booleans, null) according to RFC 8259
Helpful error reporting — invalid inputs return clear messages with line and column tracking
Test-driven development — validating behavior with a comprehensive unit and integration test suite
Maintainable design — separating scanning, parsing, and validation logic into clear modules
Interactive demo:
The live demo allows you to paste JSON or upload a JSON file and immediately see the result. Valid JSON is parsed and displayed as structured output, while invalid JSON returns a precise error that helps locate the issue quickly.
To keep parsing safe and predictable, the project includes a configurable depth limit to prevent excessive recursion on deeply nested inputs.
How it works:
The parser is built as a two-stage pipeline. First, a scanner/tokenizer reads raw text and produces tokens. Then, a recursive descent parser consumes those tokens and validates the grammar while constructing the nested JSON structure.
Key challenges solved:
Tokenizer edge cases — whitespace handling, escape sequences, and Unicode-related string rules
Recursive descent parsing — matching JSON grammar and ensuring correct nesting for objects and arrays
Error positioning — tracking input position to produce accurate line/column error messages
Specification accuracy — implementing tricky parts like number formats and strict value rules
Building this parser strengthened my understanding of parsing techniques, recursion, defensive programming, and how to design reliable low-level components with tests and clear structure.
Technologies Used
- Python
- Django