JSON Validator

Validate JSON strings and get pretty-printed or minified output.

POST 1 credit /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
Response 200 OK
{
  "valid": true,
  "pretty": "{\n  \"name\": \"Alice\",\n  \"age\": 30\n}",
  "minified": "{\"name\":\"Alice\",\"age\":30}"
}

Try It Live

Live Demo

Description

Validate JSON strings and get pretty-printed or minified output.

How to Use

1

1. Send a POST request with a `data` field containing the raw JSON string you want to validate.

2

2. Inspect the `valid` field in the response. If `true`, the `pretty` and `minified` fields contain the formatted output.

3

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

Frequently Asked Questions

What is the maximum input size?
The validator accepts JSON strings up to 1 MB (1,048,576 characters).
Does it support JSON with comments?
No. The validator uses strict JSON parsing per RFC 8259. Comments, trailing commas, and other non-standard extensions will be flagged as invalid.
Can I use this to format JSON?
Yes — when the input is valid, the `pretty` field returns indented JSON and `minified` returns the most compact representation.

Start using JSON Validator now

Get your free API key and make your first request in under a minute.