JSON Validator & JSON Schema Checker
Check JSON syntax with exact line and column of errors, and validate data against a JSON Schema (draft 4, 7, 2019-09 or 2020-12).
Result
Press “Run” to see the result.
Send the document to check in json, either as a JSON string (so syntax errors can be reported) or as an already-parsed value. If it is not valid JSON, the response has valid_json: false and a parse_error with the message, character position, line and column. A raw text/plain body is also accepted as json.
Add a schema (object or JSON string) to validate the data against a JSON Schema. The default dialect is 2020-12; set draft to 4, 7 or 2019-09 for older schemas. Each error has the instance path (e.g. /age), the failing keyword, the schema_path and a readable message; up to 200 errors are returned. Without a schema, only the syntax is checked.
The request body is limited to 5 MB. An invalid schema returns a 400 error with code invalid_schema.
Use this in your code
curl -X POST "https://apibox.io.vn/v1/json-validator" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"json":"{\"name\":\"Alice\",\"age\":-3}","schema":{"type":"object","required":["name","email"],"properties":{"name":{"type":"string"},"age":{"type":"integer","minimum":0}}}}'const res = await fetch('https://apibox.io.vn/v1/json-validator', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"json": "{\"name\":\"Alice\",\"age\":-3}",
"schema": {
"type": "object",
"required": [
"name",
"email"
],
"properties": {
"name": {
"type": "string"
},
"age": {
"type": "integer",
"minimum": 0
}
}
}
}),
});
const data = await res.json();
console.log(data);import requests
res = requests.post(
"https://apibox.io.vn/v1/json-validator",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"json": "{\"name\":\"Alice\",\"age\":-3}", "schema": {"type": "object", "required": ["name", "email"], "properties": {"name": {"type": "string"}, "age": {"type": "integer", "minimum": 0}}}},
timeout=30,
)
print(res.json())<?php
$ch = curl_init('https://apibox.io.vn/v1/json-validator');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_KEY', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => '{"json":"{\\"name\\":\\"Alice\\",\\"age\\":-3}","schema":{"type":"object","required":["name","email"],"properties":{"name":{"type":"string"},"age":{"type":"integer","minimum":0}}}}',
]);
$response = curl_exec($ch);
print_r(json_decode($response, true));API documentation → Get a free API key
FAQ
Which JSON Schema drafts are supported?
Draft 4, draft 7, 2019-09 and 2020-12 (default). Choose with the draft parameter.
How do I get the line number of a JSON syntax error?
Send the document as a string in json. When parsing fails, parse_error contains position, line and column when the parser reports them.
Can I validate syntax without a schema?
Yes. Omit schema; the response then only says whether the JSON is valid, with a note that no schema was given.