JSON Validator
Validate JSON strings and get pretty-printed or minified output.
/v1/json-validate
curl -X POST "https://devtools.toolkitapi.io/v1/json-validate" \
-H "Content-Type: application/json" \
-d '{"data": "{\"name\": \"Alice\", \"age\": 30}"}'
import httpx
resp = httpx.post(
"https://devtools.toolkitapi.io/v1/json-validate",
json={"data": "{\"name\": \"Alice\", \"age\": 30}"},
)
print(resp.json())
const resp = await fetch("https://devtools.toolkitapi.io/v1/json-validate", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({"data": "{\"name\": \"Alice\", \"age\": 30}"}),
});
const data = await resp.json();
console.log(data);
# See curl example
{
"valid": true,
"pretty": "{\n \"name\": \"Alice\",\n \"age\": 30\n}",
"minified": "{\"name\":\"Alice\",\"age\":30}"
}
Try It Live
Description
How to Use
1. Send a POST request with a `data` field containing the raw JSON string you want to validate.
2. Inspect the `valid` field in the response. If `true`, the `pretty` and `minified` fields contain the formatted output.
3. If `valid` is `false`, use the `error`, `line`, and `column` fields to locate the syntax problem.
About This Tool
JSON Validator checks whether a given string is valid JSON. When the input is valid it returns both a pretty-printed and a minified version. When the input is malformed it returns the exact error location (line and column) so you can fix the problem quickly.
Use it to sanity-check API payloads, config files, or any JSON blob before processing it downstream.
Why Use This Tool
- API debugging — Quickly verify that request/response payloads are well-formed
- Config validation — Check JSON configuration files before deployment
- Pretty-printing — Convert compact JSON into readable indented output
- Minification — Shrink JSON payloads for storage or transmission
Frequently Asked Questions
What is the maximum input size?
Does it support JSON with comments?
Can I use this to format JSON?
Start using JSON Validator now
Get your free API key and make your first request in under a minute.