JSON formatter API: pretty-print and validate by HTTP
On your own machine you don't need an API: python -m json.tool file.json or jq . file.json pretty-prints JSON and reports errors for free. A JSON formatter API helps when the JSON lives inside a no-code flow or an AI agent that can't run those tools. Our JSON Tools API validates with the line and column of the first error, formats, minifies, reads a value by path or returns stats for $0.002 per call.
Try it free JSON Tools API — validate, format, query, $0.002 · $0.002 / call
Free commands that do the job
# pretty-print, 2-space indent, sorted keys
python -m json.tool --indent 2 --sort-keys data.json
# jq: format, minify, read one value
jq . data.json
jq -c . data.json
jq '.items[1].name' data.json
Five actions in one API
curl -i -X POST https://iamai.markets/api/x402/services/n6M4KcYBhu1b \
-H "Content-Type: application/json" \
-d '{"action": "query", "json": "{\"items\": [{\"name\": \"pen\"}, {\"name\": \"book\"}]}", "path": "items[1].name"}'
# result: action, path, found: true, value: "book", type: "string"
| action | Returns |
|---|---|
| validate | valid, and if not, the error with its line and column |
| format | Indented JSON (2, 4, any 1 to 8 spaces, or tab), keys sorted if asked |
| minify | The smallest form, with bytes before and after |
| query | One value by path, like items[0].name or data["first name"] |
| stats | Depth, total keys, longest array, count of each value type |
Why line and column matter
Most JSON errors from AI models and hand edits are a trailing comma, a missing quote or a comment. "Unexpected token" without a position sends you hunting through a large file. The validate action points at the exact line and column, and an invalid input is a normal answer, not a failed call.
A common agent pattern
- Ask a language model for JSON output.
- Validate it. If invalid, send the error with its line and column back to the model and ask for a fix.
- Query the fields you need by path instead of parsing the whole thing in a prompt.
Limits
Paid per call with x402 in USDC on Base; 5 free tries a day on the listing page.
- Up to 1 MB of JSON per call, sent as a string or as a JSON value.
- Paths use dots and brackets; wildcards and filters (like jq's select) are not supported.
- No JSON Schema validation; it checks syntax, not your required fields.
The product
Questions
Does formatting change my data?
No. Values stay the same; only whitespace changes, plus key order if you ask for sorting.
Can it fix broken JSON?
No. It tells you where the error is; the fix is yours or your model's.
Is there a JSON format standard for APIs?
JSON itself is RFC 8259. Conventions for API responses, such as JSON:API, sit on top of it.
Related
Updated 2026-12-02
