# JSON Tools
A zero-dependency JSON formatter / validator / minifier / path query.
```
python scripts/run.py format data.json --sort
python scripts/run.py minify data.json
python scripts/run.py validate data.json
echo '{"a":{"b":[1,2,3]}}' | python scripts/run.py get - a.b.1
```
Pure Python stdlib — runs anywhere.
---
name: json-tools
display_name: JSON Tools
description: "Format, validate, minify, and query JSON. Use when the user pastes JSON and wants it pretty-printed, validated, compacted, or wants to extract a value by dot/bracket path (jq-like). Triggers: format json, validate json, minify json, json path, pretty print."
---
# JSON Tools
Format, validate, minify, and query JSON from chat.
## When to use
The user pastes JSON or a `.json` file and wants it pretty-printed, validated (with a precise error location), compacted to one line, or wants to pull out a value by path.
## How to use
Run `scripts/run.py` with a mode:
- `python scripts/run.py format <file>` — pretty-print (2-space indent, keys sorted optional with `--sort`).
- `python scripts/run.py minify <file>` — compact to one line.
- `python scripts/run.py validate <file>` — validate; on error print line/column and the offending snippet.
- `python scripts/run.py get <file> <path>` — extract a value, e.g. `users.0.name` or `data["a-b"].id`.
Read from stdin by passing `-` as the file. Output goes to stdout.
## Pitfalls
- Trailing commas / comments are NOT valid JSON — `validate` will report the exact position.
- For huge files prefer `minify`/`get` over `format` to avoid flooding chat.
JSON Tools by langbot-team
Format, validate, minify, and query JSON.
Loading...