JSON Schema Validator

Define a Draft-07 or Draft 2020-12 JSON Schema and validate your target JSON data payload in real time.

How to Validate JSON Against a Schema

1

Provide JSON Schema

Paste your JSON Schema definition on the left, click Upload Schema, or click Sample Schema.

2

Provide Target Data

Paste the target JSON payload on the right, click Upload Data, or click Sample Data.

3

Instant AJV Validation

Validation runs automatically in real time. Inspect green passing confirmations or line-number error highlights in red.

Tool Options

Draft-07 & 2020-12 Engine

Powered by AJV for high-performance compliance checks across official JSON Schema specifications.

Path-Based Violation Errors

Pinpoints property JSONPointer locations (`/properties/age`), keywords (`minimum`), and failure reasons.

Type & Constraint Assertions

Validates data types (`string`, `number`, `boolean`, `array`, `object`), `required` fields, and format keywords.

Your Data Privacy

Web Tool
Privacy-First Architecture
Most of our web tools process your data entirely in-browser. Where server processing is technically required, payloads are evaluated statelessly in-memory and are never stored, saved, or logged.
REST API
Stateless In-Memory Processing
When you use our API endpoints, your requests are processed strictly in-memory without persistent database storage, disk logging, or data retention.
Want to learn more about how we safeguard your information and infrastructure?
Read our full Privacy Policy for detailed security standards, data retention principles, and compliance guarantees.

What does the JSON Schema Validator do?

The JSON Schema Validator verifies whether target JSON data conforms strictly to predefined Draft-07 or Draft 2020-12 JSON Schema specifications. Powered by the AJV (Another JSON Schema Validator) engine, it performs single-pass schema compilation, enforces structural constraints, and reports schema violations with exact JSONPointer instance paths.

  • AJV Draft-07 & Draft 2020-12 Compliance: Validates complex schema vocabularies, including $defs, prefixItems, oneOf, anyOf, allOf, and format keywords.
  • Precision JSONPointer Diagnostics: Pinpoints non-conforming nodes (e.g. /users/0/role) and highlights the corresponding line in red directly in the editor gutter.
  • 100% In-Browser In-Memory Execution: Performs schema compilation and data validation entirely client-side with zero remote server logging.

Core Concepts & Technical Specifications

  1. Schema Compilation & JSONPointer Instance Pathing:
    • AJV compiles the declarative schema into optimized JavaScript validation functions. When a validation constraint fails, the engine generates an instancePath (e.g. /addresses/0/postalCode) identifying the exact failing key or array element.
    • Keyword failures specify the constraint violated (type, required, minimum, format, additionalProperties) alongside runtime parameter values.
  2. Draft-07 vs. Draft 2020-12 Vocabulary Differences:
    • Tuple Validation: Draft-07 uses an array under the items keyword for positional tuple checking. Draft 2020-12 standardizes prefixItems for positional types and reserves items for the remaining array elements.
    • Reusable Definitions: Draft-07 uses definitions, whereas Draft 2020-12 standardizes on $defs and improves dynamic scoping with $dynamicRef and $dynamicAnchor.
  3. Format & Boundary Validation Quirks:
    • Built-in format validators enforce RFC specifications for email, date-time (ISO 8601), uri, uuid (RFC 4122), and ipv4/ipv6.
    • additionalProperties: false forbids undeclared keys within its specific scope. For deeply nested structures, additionalProperties: false must be declared on each sub-schema level to prevent child object leakage.

How to use the tool?

  1. Provide Schema and Data:
    • Paste or upload a .json schema definition in the left editor and your target JSON payload in the right editor, or click Sample to load matching test models simultaneously.
  2. Review Real-Time Gutter Diagnostics:
    • Validation triggers automatically on keystroke. If any constraint fails, the specific failing field is highlighted in red in the line-number gutter with a descriptive error report.
  3. Export Reports:
    • Click Download to save the diagnostic validation log as output.txt or click Copy Report to copy errors directly to your clipboard.

Pipeline & Contextual Workflows

  • Syntax Pre-Check Pipeline: Run unverified JSON through JSON Syntax Validator to ensure standard RFC 8259 compliance before applying schema validation rules here.
  • Cross-Format Validation: If your configuration is stored in YAML format, evaluate it against your schema using YAML Schema Validator.
  • Type Generation: Once your schema is finalized, convert your JSON payload into strongly typed definitions using JSON to TypeScript.

REST API Integration

blueutils.com provides a free REST API endpoint (POST https://blueutils.com/api/json/schema) to validate JSON payloads against JSON Schemas programmatically in build pipelines, test suites, and microservices.

API Request Parameters

Name Type Description Example
data Object / String Target JSON object or raw JSON string payload to validate. {"user":"alex_dev","role":"developer"}
schema Object / String JSON Schema object or raw JSON string defining validation rules. {"type":"object","required":["user","role"]}

API Request Payload Examples

cURL (Using Direct JSON Objects)

curl -X POST https://blueutils.com/api/json/schema \
  -H "Content-Type: application/json" \
  -d '{
    "data": {
      "user": "alex_dev",
      "role": "developer",
      "age": 28
    },
    "schema": {
      "type": "object",
      "properties": {
        "user": { "type": "string", "minLength": 3 },
        "role": { "type": "string", "enum": ["admin", "developer", "guest"] },
        "age": { "type": "integer", "minimum": 18 }
      },
      "required": ["user", "role"]
    }
  }'

cURL (Using Raw String Payloads)

curl -X POST https://blueutils.com/api/json/schema \
  -H "Content-Type: application/json" \
  -d '{
    "data": "{\"user\":\"alex_dev\",\"role\":\"developer\",\"age\":28}",
    "schema": "{\"type\":\"object\",\"properties\":{\"user\":{\"type\":\"string\"}},\"required\":[\"user\"]}"
  }'

Python

import requests

url = "https://blueutils.com/api/json/schema"
payload = {
    "data": {
        "user": "alex_dev",
        "role": "developer",
        "age": 28
    },
    "schema": {
        "type": "object",
        "properties": {
            "user": {"type": "string"},
            "role": {"type": "string", "enum": ["admin", "developer", "guest"]},
            "age": {"type": "integer", "minimum": 18}
        },
        "required": ["user", "role"]
    }
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())

Java

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String jsonPayload = """
            {
                "data": {
                    "user": "alex_dev",
                    "role": "developer",
                    "age": 28
                },
                "schema": {
                    "type": "object",
                    "properties": {
                        "user": { "type": "string" },
                        "role": { "type": "string", "enum": ["admin", "developer", "guest"] }
                    },
                    "required": ["user", "role"]
                }
            }
            """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://blueutils.com/api/json/schema"))
            .header("Content-Type", "application/json")
            .POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
            .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}

API Response Parameters

Name Type Description Example
isValid Boolean Indicates whether target data conforms strictly to the schema. true
message String Confirmation message returned when validation succeeds. "Target JSON data strictly conforms to the provided JSON Schema."
errorCount Number Number of validation errors detected. 0
error String Error summary returned when validation fails. "Schema validation failed."
errors Array Array of specific error items containing path, keyword, message, and params. [...]

API Response Payload Examples

Success Response (HTTP 200 OK)

{
  "isValid": true,
  "message": "Target JSON data strictly conforms to the provided JSON Schema.",
  "errorCount": 0
}

Validation Failure Response (HTTP 400 Bad Request)

{
  "isValid": false,
  "error": "Schema validation failed.",
  "errorCount": 1,
  "errors": [
    {
      "path": "/role",
      "keyword": "enum",
      "message": "must be equal to one of the allowed values",
      "params": {
        "allowedValues": ["admin", "developer", "guest"]
      },
      "schemaPath": "#/properties/role/enum"
    }
  ]
}

Rate Limit Exceeded Response (HTTP 429 Too Many Requests)

{
  "error": "API rate limit exceeded. Please wait or contact support@blueutils.com."
}

Why use an API to validate JSON schemas?

Programmatic schema validation prevents invalid payloads from corrupting downstream microservices and databases:

  • API Gateway Contract Testing: Enforce request/response payloads match OpenAPI or JSON Schema contracts before forwarding to internal services.
  • Config Linting in CI/CD: Automatically validate application config files, feature flags, and deployment manifests against central schemas during pull request checks.
  • Autonomous Agent Output Verification: Guarantee that structured JSON produced by Large Language Models adheres to strict database insertion schemas.

Native Usage

Visual Studio Code Schema Binding

Map custom JSON Schemas in .vscode/settings.json:

{
  "json.schemas": [
    {
      "fileMatch": ["/config/*.json"],
      "url": "./schemas/config.schema.json"
    }
  ]
}

Or declare the schema directly inside your JSON file via $schema:

{
  "$schema": "./schemas/config.schema.json",
  "appName": "blueutils.com",
  "port": 8080
}

Windows (CMD / PowerShell)

# Using Python jsonschema in PowerShell
python -c "import json, jsonschema; jsonschema.validate(instance=json.load(open('data.json')), schema=json.load(open('schema.json')))"

Linux / Unix (Bash)

# Using ajv-cli tool
npx ajv-cli validate -s schema.json -d data.json

Python

Using jsonschema in Python:

import json
import jsonschema
from jsonschema import validate, ValidationError

with open("schema.json") as sf, open("data.json") as df:
    schema = json.load(sf)
    data = json.load(df)

try:
    validate(instance=data, schema=schema)
    print("JSON data conforms to schema successfully.")
except ValidationError as err:
    print(f"Validation error at path '{list(err.path)}': {err.message}")

Java

Using networknt/json-schema-validator in Java:

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.networknt.schema.JsonSchema;
import com.networknt.schema.JsonSchemaFactory;
import com.networknt.schema.SpecVersion;
import com.networknt.schema.ValidationMessage;
import java.io.File;
import java.util.Set;

public class JsonSchemaValidatorExample {
    public static void main(String[] args) throws Exception {
        ObjectMapper mapper = new ObjectMapper();
        JsonNode data = mapper.readTree(new File("data.json"));
        JsonNode schemaNode = mapper.readTree(new File("schema.json"));

        JsonSchemaFactory factory = JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.V7);
        JsonSchema schema = factory.getSchema(schemaNode);

        Set<ValidationMessage> errors = schema.validate(data);
        if (errors.isEmpty()) {
            System.out.println("JSON data is valid against schema.");
        } else {
            errors.forEach(e -> System.out.println("Error: " + e.getMessage()));
        }
    }
}

Frequently Asked Questions (FAQ)

What is the difference between oneOf, anyOf, and allOf in JSON Schema evaluation?

oneOf requires data to validate against exactly one sub-schema, anyOf succeeds if at least one sub-schema matches, and allOf requires data to satisfy all combined sub-schemas simultaneously.

Why does additionalProperties: false fail on nested objects without explicit declaration?

In JSON Schema, additionalProperties: false applies strictly to the immediate object scope where it is declared. Child and deeply nested objects do not inherit this rule unless additionalProperties: false is defined on each nested schema level.

How does JSON Schema Draft 2020-12 handle tuple validation compared to Draft-07?

Draft 2020-12 replaces positional tuple arrays in items with prefixItems, reserving items strictly for validating additional array elements that follow the prefix tuple elements.

How do I reference internal reusable models using $defs and $ref identifiers?

Define reusable sub-schemas inside the $defs block (or definitions in Draft-07) and reference them using JSONPointer URI syntax, such as $ref: "#/$defs/UserAddress".

How do I validate JSON data against a JSON Schema in automated CI/CD pipelines?

Use AJV CLI (npx ajv-cli validate -s schema.json -d data.json) or Python check-jsonschema (check-jsonschema --schemafile schema.json data.json) to fail builds on contract violations.

Rate Limits

UI Limits
100 uses per 15 minutes
Max payload size: 5 MB
API Limits
5 requests per 60 minutes
Max payload size: 256 KB
Need higher API rate limits, increased payload sizes, or custom developer solutions?
Contact our engineering team at support@blueutils.com for custom rate limit increases, higher quota allocations, or tailored enterprise integrations.