Schema Toolkit · 100% Local · Browser Only

    JSON Schema Validator

    Validate JSON against JSON Schema and see expected types, missing required fields, enum mismatches, and format problems instantly.

    Browser only Valid Schema / Data
    Data
    13 lines
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    JSON Schema
    23 lines
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    ✓ Valid JSON: Matches schema perfectly

    Schema Metrics

    Fields
    12
    Objects
    2
    Arrays
    1
    Constraints
    4

    Field Hierarchy Tree

    Root(object)
    └─id*(integer)
    └─name*(string)
    └─email*(string)
    email
    └─active(boolean)
    └─createdAt(string)
    date-time
    └─profile(object)
    └─phone(string)
    └─country(string)
    └─company(string)
    └─roles(array)
    └─items[](string)

    Schema Constraints

    $.name(1 rule)
    minLength:1
    $.email(1 rule)
    format:email
    $.createdAt(1 rule)
    format:date-time
    $.roles[](1 rule)
    enum:["admin","developer","member"]
    Ajv-Powered JSON Schema Validation Engine
    100% Local Browser Engine

    Validate JSON Against JSON Schema (Draft-07, Draft-06, 2020-12)

    Validate JSON data payloads against JSON Schema specifications in real time. Powered by the industry-standard Ajv validator engine, it detects missing required fields, primitive data type mismatches, string format errors (email, date-time, uuid, uri), numeric minimum/maximum bounds, enum constraints, and unallowed additionalProperties—with 100% browser-only privacy.

    Validation EngineAjv 8+ (High Speed)
    Draft StandardsDraft-07 / Draft-06 / 2020-12
    Error TracebacksLine-by-Line Pointers
    Privacy100% Client-Side

    Interactive Validation Error Scenarios Explorer

    Select a JSON Schema validation failure scenario to inspect schema rules, payload data, and error tracebacks:

    Required Field
    Schema Definition

    1. Missing Required Property Key

    Ensure all mandatory fields listed in the schema's `required` array are present in the JSON payload.

    Target JSON Schema
    {
      "type": "object",
      "required": ["userId", "email"],
      "properties": {
        "userId": { "type": "integer" },
        "email": { "type": "string" }
      }
    }
    Test Payload Data
    {
      "userId": 9041
      // Missing "email" property
    }
    Ajv Validation Output
    ❌ Error: / must HAVE required property 'email'
    Schema Studio Suite Features

    Complete Schema Studio Tools & Tab Guide

    Select a tool tab to explore features, input samples, code outputs, and use-case explanations:

    Validator Mode
    Interactive Studio Tool

    1. JSON Schema Validator

    Validate raw JSON payloads against JSON Schema Draft-07, Draft-06, and Draft 2020-12 definitions with instant Ajv error highlights.

    Key Capabilities:
    • Real-time Ajv schema compilation and instant error tracebacks
    • Line-by-line pointer paths (e.g. /user/address/zipcode)
    • Supports Draft-07, Draft-06, and Draft 2020-12 standards
    • 100% client-side validation without remote server data relay
    Input Sample
    // Schema Definition
    {
      "type": "object",
      "required": ["email", "age"],
      "properties": {
        "email": { "type": "string", "format": "email" },
        "age": { "type": "integer", "minimum": 18 }
      }
    }
    
    // Payload Data
    {
      "email": "user@example.com",
      "age": 16
    }
    Output Code / Result
    ❌ JSON Validation Failed (1 Error):
    1. /age: must be >= 18 (failed minimum constraint)

    Why, When, & How to Validate JSON Schemas

    Why Validate JSON Schemas?

    Validating JSON payloads against JSON Schemas guarantees contract compliance before database writes, prevents unhandled runtime exceptions, and blocks malicious property injections.

    When to Run Validation?

    Execute schema validation in API Gateway middleware, pre-commit Git hooks, CI/CD deployment pipelines, webhook receiver endpoints, and frontend form submission handlers.

    How Does the Engine Work?

    Paste your JSON Schema definition and JSON test payload. The browser-side Ajv engine compiles the schema, tests all properties, and highlights exact line-by-line pointer paths for any failure.

    Common Validation Bugs & Troubleshooting Guide

    Bug 1: Format Keyword Ignored Without ajv-formats

    Silent Validation Bypass

    Specifying `"format": "email"` or `"format": "date-time"` in JSON Schema Draft-07 does not throw errors by default in Ajv v8+ unless format plugins (`ajv-formats`) are explicitly compiled.

    Fix: Include `const addFormats = require('ajv-formats'); addFormats(ajv);` during Ajv compiler setup.

    Bug 2: Stringified Numbers Failing Type Enforcement

    Payload Type Failure

    Sending `"age": "28"` instead of `"age": 28` causes strict type validators to throw HTTP 400 Bad Request or HTTP 422 Unprocessable Entity errors.

    Fix: Use `coerceTypes: true` option in Ajv if you expect stringified query parameters, or cast types on the frontend before sending.

    Bug 3: Unrestricted Object Key Injections

    Security Vulnerability

    Without `"additionalProperties": false`, clients can pass unexpected property keys that bypass payload sanitization and contaminate backend ORM models.

    Fix: Enforce `"additionalProperties": false` in API request schemas to reject unallowed payload keys.

    Bug 4: Null Value Failures for Optional Properties

    Runtime Exception

    Omitting `null` from string types (`"type": "string"`) causes database null values to fail payload validation.

    Fix: Use `"type": ["string", "null"]` or `anyOf` schema constructs for nullable optional attributes.

    JSON Schema Validation Best Practices

    1. Enable Strict Format Validation

    Always validate string formats (`email`, `date-time`, `uuid`, `uri`, `ipv4`) to prevent malformed text strings from entering database tables.

    2. Restrict Extra Keys with additionalProperties

    Set `additionalProperties: false` on request payload schemas to block unauthorized property injection attacks.

    3. Explicit Required Arrays

    Maintain a mandatory `required: [...]` array containing all primary keys, timestamps, and non-null database attributes.

    4. Modularize Schemas with $defs

    Store shared sub-schemas (e.g. `Address`, `MoneyAmount`) inside `$defs` and reference them using `{"$ref": "#/$defs/Address"}`.

    Programmatic JSON Schema Validation Code Examples

    Validate payloads against JSON Schemas across popular programming languages:

    // Node.js - Validate JSON Payload against JSON Schema using Ajv
    const Ajv = require("ajv");
    const addFormats = require("ajv-formats");
    
    const schema = {
      type: "object",
      required: ["userId", "email"],
      properties: {
        userId: { type: "integer" },
        email: { type: "string", format: "email" }
      },
      additionalProperties: false
    };
    
    const ajv = new Ajv({ allErrors: true });
    addFormats(ajv);
    
    const validate = ajv.compile(schema);
    const valid = validate({ userId: 101, email: "developer@jsonifytools.com" });
    
    if (valid) {
      console.log("JSON Payload is 100% valid!");
    } else {
      console.error("Ajv Validation Errors:", validate.errors);
    }
    Standards & Specification Comparison

    JSON Schema Specification Versions (Draft-04 vs Draft-07 vs 2020-12 vs OpenAPI)

    Understand key differences across JSON Schema draft standards to select the right specification for your validation engine:

    Specification VersionSchema URI Header ($schema)Identifier KeyDefinition ContainerPrimary Use Case
    Draft-07 (Recommended)http://json-schema.org/draft-07/schema#$iddefinitionsIndustry standard supported by Ajv, Swagger, & Postman.
    Draft 2020-12 (Modern)https://json-schema.org/draft/2020-12/schema$id & $anchor$defsModern standard aligned with OpenAPI 3.1.0 and JSON Hyper-Schema.
    Draft-04 (Legacy)http://json-schema.org/draft-04/schema#iddefinitionsLegacy systems and older backend validation libraries.
    OpenAPI 3.0 / 3.1openapi: 3.0.0 / 3.1.0components/schemasschemasREST API documentation, Swagger UI, and Gateway validation.
    CI/CD & DevOps Blueprint

    Enterprise API Governance & CI/CD Validation Pipeline Blueprint

    Enforce JSON Schema validation across developer workstations, GitHub Actions pipelines, and microservice API gateways:

    Pre-Commit Git Hooks

    Validate sample API JSON fixtures against your JSON Schema definitions locally using Husky and ajv-cli before committing code to git repositories.

    npx ajv-cli validate -s ./schemas/user.json -d ./fixtures/user_payload.json

    API Gateway Schema Enforcement

    Deploy generated JSON Schemas directly to Kong, AWS API Gateway, or NGINX to validate HTTP request bodies at the edge before hitting upstream backend microservices.

    # AWS API Gateway Request Validator Plugin aws apigateway create-request-validator --rest-api-id ...

    Frequently Asked Questions (FAQs)

    Related Developer Tools

    Explore more free developer tools to speed up debugging, testing, and development.