A website where developers paste JSON and a Swift DecodingError string, and the site visualizes exactly where in the JSON decoding failed — highlighting the node at the error's codingPath.
site/ Vanilla HTML/CSS/JS — no build step. Hosted on GitHub Pages.
index.html Single-page app entry point
app.js Controller: live-updates on input, loads fixtures, adapts parser output to flat paths
parser.js Recursive descent parser for DecodingError description strings
tree.js JSON tree renderer; takes flat (string|number)[] highlight path
style.css All styling
fixtures/*.json Generated fixture files used as "Try an example" inputs
tests/ Unit tests for the parser
parser.test.js Loads fixture files at runtime; defines expected outputs and static edge-case tests
index.html Browser-based test runner
run.js CLI test runner: bun tests/run.js
fixtures/ Swift Package that generates real DecodingError strings as fixture files
- No build step. Serve
site/with any static server (e.g.python3 -m http.server -d site). - Regenerate fixtures:
cd fixtures && swift run Fixtures ../site/fixtures - Run tests (CLI):
bun tests/run.js— requires Bun (not Node; Node'sfetchdoesn't supportfile://URLs) - Run tests (browser): open
tests/index.htmlvia a static server, not directly as a file (samefile://fetch restriction applies)
parser.jsoutputs{ errorCase, codingPath: [{key}|{index}][], ... }.app.jsconverts this to a flat(string|number)[]viatoFlatPath()before passing totree.jsandresolvePath().- Adding a fixture requires: a new
generate*()function infixtures/Sources/Fixtures/Fixtures.swift, runningswift run Fixtures, adding the filename toFIXTURESinapp.js(if it should appear as an example), and adding the ID + expected output totests/parser.test.js. site/fixtures/invalid-json.jsonexists for test coverage only and is intentionally excluded from theFIXTURESarray inapp.js(it can't be visualised). Do not add it there.