Programmatic access to JSON validation and formatting tools
Our JSON API provides endpoints for validating, formatting, and comparing JSON documents. All endpoints accept and return JSON data.
Currently, the API is open and does not require authentication. However, rate limiting may be implemented in the future.
Validates a JSON document and returns the parsed data if valid.
{
"json": "{\"name\":\"John\",\"age\":30}"
}
{
"status": "success",
"message": "Valid JSON",
"data": {
"name": "John",
"age": 30
}
}
{
"status": "error",
"message": "Invalid JSON",
"error": "Syntax error"
}
Validates a JSON document against a JSON Schema.
{
"json": "{\"name\":\"John\",\"age\":30}",
"schema": "{
\"type\":\"object\",
\"properties\":{
\"name\":{\"type\":\"string\"},
\"age\":{\"type\":\"number\"}
},
\"required\":[\"name\",\"age\"]
}"
}
{
"status": "success",
"message": "JSON is valid according to the schema",
"data": {
"name": "John",
"age": 30
}
}
{
"status": "error",
"message": "JSON does not match schema",
"errors": [
{
"instancePath": "/age",
"message": "must be a number"
}
]
}
Formats a JSON document with specified indentation.
{
"json": "{\"name\":\"John\",\"age\":30}",
"indent": 2
}
{
"status": "success",
"message": "JSON formatted successfully",
"data": "{
\"name\": \"John\",
\"age\": 30
}"
}
Compares two JSON documents and returns the differences.
{
"json1": "{\"name\":\"John\",\"age\":30}",
"json2": "{\"name\":\"John\",\"age\":31}"
}
{
"status": "success",
"message": "JSON comparison completed",
"data": {
"are_equal": false,
"differences": [
{
"path": ["age"],
"old_value": 30,
"new_value": 31
}
]
}
}
Here's an example of how to use the API with cURL:
# Validate JSON
curl -X POST https://jsonlint.pro/api/json/validate \
-H "Content-Type: application/json" \
-d '{"json":"{\"name\":\"John\",\"age\":30}"}'
# Format JSON
curl -X POST https://jsonlint.pro/api/json/format \
-H "Content-Type: application/json" \
-d '{"json":"{\"name\":\"John\",\"age\":30}","indent":2}'
# Compare JSON
curl -X POST https://jsonlint.pro/api/json/compare \
-H "Content-Type: application/json" \
-d '{"json1":"{\"name\":\"John\",\"age\":30}","json2":"{\"name\":\"John\",\"age\":31}"}'