JSON Schema validator

Validate JSON against a JSON Schema and list every violation with its location.

Input

The JSON document to validate.
The JSON Schema.

Result

Fill in the input and press Run.

Your input is processed in memory and then discarded. It is not stored or logged. Even so, don't paste live passwords or keys into any online tool.

Use it from code or an agent

curl -s https://setget.net/v1/tools/json-schema-validate \
  -H 'Content-Type: application/json' \
  -d '{"input":{"text":"{\"name\":\"Sam\",\"age\":\"31\"}","schema":"{\"type\":\"object\",\"required\":[\"name\",\"age\"],\"properties\":{\"age\":{\"type\":\"integer\"}}}"}}'
import json, urllib.request

body = {'input': {'text': '{"name":"Sam","age":"31"}', 'schema': '{"type":"object","required":["name","age"],"properties":{"age":{"type":"integer"}}}'}}
request = urllib.request.Request("https://setget.net/v1/tools/json-schema-validate", json.dumps(body).encode(),
                                 {"Content-Type": "application/json"})
print(json.load(urllib.request.urlopen(request))["result"])
const response = await fetch("https://setget.net/v1/tools/json-schema-validate", {
  method: "POST",
  headers: {"Content-Type": "application/json"},
  body: JSON.stringify({"input":{"text":"{\"name\":\"Sam\",\"age\":\"31\"}","schema":"{\"type\":\"object\",\"required\":[\"name\",\"age\"],\"properties\":{\"age\":{\"type\":\"integer\"}}}"}}),
});
console.log((await response.json()).result);
Tool: run_tool
Arguments:
{
  "slug": "json-schema-validate",
  "input": {
    "text": "{\"name\":\"Sam\",\"age\":\"31\"}",
    "schema": "{\"type\":\"object\",\"required\":[\"name\",\"age\"],\"properties\":{\"age\":{\"type\":\"integer\"}}}"
  }
}
{
  "input": {
    "text": "{\"name\":\"Sam\",\"age\":\"31\"}",
    "schema": "{\"type\":\"object\",\"required\":[\"name\",\"age\"],\"properties\":{\"age\":{\"type\":\"integer\"}}}"
  }
}

Endpoint: POST /v1/tools/json-schema-validate. Over MCP: run_tool with slug: "json-schema-validate". Machine-readable: input schema, Markdown. Connect an agent.

Inputs

NameTypeRequiredWhat it does
text string yes The JSON document to validate.
schema string yes The JSON Schema.

Examples

Input
{
  "text": "{\"name\":\"Sam\",\"age\":\"31\"}",
  "schema": "{\"type\":\"object\",\"required\":[\"name\",\"age\"],\"properties\":{\"age\":{\"type\":\"integer\"}}}"
}
Result
{
  "valid": false,
  "errors": [
    {
      "path": "$.age",
      "message": "'31' is not of type 'integer'",
      "rule": "type"
    }
  ]
}

A valid document

Input
{
  "text": "{\"name\":\"Sam\",\"age\":31}",
  "schema": "{\"type\":\"object\",\"required\":[\"name\"]}"
}
Result
{
  "valid": true,
  "errors": []
}

Questions

Which schema drafts work?
The draft named in "$schema" is used. Without one, the latest draft (2020-12) applies.
Are remote $ref URLs fetched?
No. This tool never makes network requests, so every $ref must point inside the schema.