https://github.com/leptos-null/codingpathvisualizer
A website to visualize Swift DecodingError for a JSON string
https://github.com/leptos-null/codingpathvisualizer
decodingerror swift-decoding swift-json tools
Last synced: about 1 month ago
JSON representation
A website to visualize Swift DecodingError for a JSON string
- Host: GitHub
- URL: https://github.com/leptos-null/codingpathvisualizer
- Owner: leptos-null
- License: mit-0
- Created: 2026-04-06T16:58:35.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2026-04-25T23:55:47.000Z (about 2 months ago)
- Last Synced: 2026-04-26T01:22:57.956Z (about 2 months ago)
- Topics: decodingerror, swift-decoding, swift-json, tools
- Language: JavaScript
- Homepage: https://leptos-null.github.io/CodingPathVisualizer/
- Size: 17.6 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# CodingPath Visualizer
Paste JSON and a Swift `DecodingError` string, and see exactly which node in the JSON tree caused the failure.
## Usage
1. Paste your JSON payload into the **JSON** field.
2. Paste the output of `String(describing: error)` for a `DecodingError` into the **DecodingError** field.
3. The tree view highlights the node at the error's `codingPath`. For `keyNotFound` errors, the missing key is shown as a ghost entry.
Click any of the built-in examples to see it in action.
### Supported error cases
| Case | What it highlights |
|---|---|
| `typeMismatch` | The value that had the wrong type |
| `valueNotFound` | The `null` where a value was expected |
| `keyNotFound` | The parent object, with the missing key shown inline |
| `dataCorrupted` | The value that couldn't be parsed |
## Development
No build step required. Serve `site/` with any static server:
```sh
python3 -m http.server -d site
```
### Run tests
```sh
bun tests/run.js
```
Requires [Bun]() (Node's `fetch` doesn't support `file://` URLs).
Tests can also be run in the browser by opening `tests/index.html` through a local server.
### Regenerate fixtures
The `fixtures/` directory is a Swift Package that produces real `DecodingError` strings by decoding intentionally malformed JSON. To regenerate:
```sh
cd fixtures && swift run Fixtures ../site/fixtures
```