Developer5 min read

JSON Schema Validation Explained: Validate JSON Against a Schema Online

Tags:JSONJSON SchemaDeveloper ToolsAPI DevelopmentData Validation

The FindUtils JSON Schema Validator lets you paste a JSON Schema and a data payload, then instantly validates whether the data conforms — all in your browser with no data uploaded to servers. You can also auto-generate schemas from sample JSON using the FindUtils Schema Generator.

JSON Schema is a vocabulary for validating JSON structure. Instead of discovering data errors at runtime, schema validation catches problems immediately. It's like a blueprint that says "JSON data must have these fields, with these types, and these constraints."

What is JSON Schema

JSON Schema defines the rules JSON data must follow:

JSON
1
2
3
4
5
6
7
8
9
10
{
  "type": "object",
  "properties": {
    "id": { "type": "integer" },
    "name": { "type": "string" },
    "email": { "type": "string", "format": "email" },
    "age": { "type": "integer", "minimum": 0, "maximum": 150 }
  },
  "required": ["id", "name", "email"]
}

This schema says:

  • The data must be a JSON object
  • It must have properties: id, name, email, age
  • id must be an integer
  • name and email must be strings
  • email must be a valid email format
  • age must be between 0 and 150
  • id, name, and email are required (others optional)

How to Get Started

Use the FindUtils JSON Schema Validator to validate data against schemas, or the JSON Schema Generator to auto-generate schemas from sample data. Both tools run entirely in your browser, so your JSON data stays private.

Key Schema Keywords

Basic Type Keywords

KeywordPurposeExample
typeData type"type": "string"
propertiesObject properties"properties": { "name": {...} }
requiredRequired fields"required": ["id", "name"]

Constraint Keywords

KeywordPurposeExample
minimumMinimum value"minimum": 0
maximumMaximum value"maximum": 100
minLengthMinimum string length"minLength": 3
maxLengthMaximum string length"maxLength": 50
patternRegex pattern"pattern": "^[a-z]+$"
enumAllowed values"enum": ["active", "inactive"]
formatSpecial formats"format": "email"

Type Constraints

JSON
1
2
3
4
5
6
{
  "type": "string",
  "minLength": 3,
  "maxLength": 50,
  "pattern": "^[A-Z][a-z]*$"  // Must start with capital letter
}

This string must be:

  • 3 to 50 characters long
  • Start with a capital letter
  • Contain only letters

How to Validate JSON Against a Schema Online

Step 1: Write or Paste Your Schema

Create a JSON Schema defining your data rules. Start simple:

JSON
1
2
3
4
5
6
7
8
9
{
  "type": "object",
  "properties": {
    "username": { "type": "string" },
    "password": { "type": "string", "minLength": 8 },
    "email": { "type": "string", "format": "email" }
  },
  "required": ["username", "password", "email"]
}

Step 2: Paste Your Data

Paste the JSON you want to validate:

JSON
1
2
3
4
5
{
  "username": "johndoe",
  "password": "securePassword123",
  "email": "[email protected]"
}

Step 3: Click Validate

The validator checks if data conforms to schema:

  • Valid — Data matches all rules
  • Invalid — Data violates rules, with specific error messages

Step 4: Fix Errors

If invalid, the validator shows exactly what's wrong:

Error: password must be at least 8 characters
Error: email is not a valid email format

How to Auto-Generate a Schema from Existing JSON

Writing schemas manually is tedious. A schema generator creates one from sample JSON:

Step 1: Paste Sample JSON

JSON
1
2
3
4
5
6
7
8
9
10
{
  "user": {
    "id": 123,
    "name": "John Doe",
    "email": "[email protected]",
    "age": 30,
    "active": true,
    "tags": ["admin", "developer"]
  }
}

Step 2: Generate Schema

Open the findutils.com JSON Schema Generator and the tool infers the schema:

JSON
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{
  "type": "object",
  "properties": {
    "user": {
      "type": "object",
      "properties": {
        "id": { "type": "integer" },
        "name": { "type": "string" },
        "email": { "type": "string" },
        "age": { "type": "integer" },
        "active": { "type": "boolean" },
        "tags": {
          "type": "array",
          "items": { "type": "string" }
        }
      }
    }
  }
}

Step 3: Refine

Add constraints:

JSON
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{
  "type": "object",
  "properties": {
    "user": {
      "type": "object",
      "properties": {
        "id": { "type": "integer" },
        "name": { "type": "string", "minLength": 1 },
        "email": { "type": "string", "format": "email" },
        "age": { "type": "integer", "minimum": 0, "maximum": 150 },
        "active": { "type": "boolean" },
        "tags": {
          "type": "array",
          "items": { "type": "string" }
        }
      },
      "required": ["id", "name", "email"]
    }
  }
}

Common Validation Errors and How to Fix Them

Error: Type Mismatch

Schema:

JSON
{ "type": "integer" }

Invalid Data:

JSON
"123"  // String, not integer

Fix: Use the correct type: 123 (without quotes)

Error: Missing Required Field

Schema:

JSON
1
2
3
4
{
  "properties": { "email": { "type": "string" } },
  "required": ["email"]
}

Invalid Data:

JSON
{ "name": "John" }  // Missing email

Fix: Include all required fields

Error: Value Out of Range

Schema:

JSON
1
2
3
4
5
{
  "type": "integer",
  "minimum": 0,
  "maximum": 100
}

Invalid Data:

JSON
150  // Exceeds maximum

Fix: Use a value between 0 and 100

Error: Invalid Format

Schema:

JSON
1
2
3
4
{
  "type": "string",
  "format": "email"
}

Invalid Data:

JSON
"john.example.com"  // Missing @

Fix: Use valid email: "[email protected]"

Practical Example: User Registration API

Your API accepts user registration with this schema:

JSON
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{
  "type": "object",
  "properties": {
    "username": {
      "type": "string",
      "minLength": 3,
      "maxLength": 20,
      "pattern": "^[a-zA-Z0-9_]+$"
    },
    "password": {
      "type": "string",
      "minLength": 8
    },
    "email": {
      "type": "string",
      "format": "email"
    },
    "age": {
      "type": "integer",
      "minimum": 13,
      "maximum": 120
    },
    "terms_accepted": {
      "type": "boolean"
    }
  },
  "required": ["username", "password", "email", "terms_accepted"]
}

Valid registration:

JSON
1
2
3
4
5
6
7
{
  "username": "john_doe123",
  "password": "securePassword123",
  "email": "[email protected]",
  "age": 25,
  "terms_accepted": true
}

Invalid (multiple errors):

JSON
1
2
3
4
5
6
7
{
  "username": "jd",  // Too short
  "password": "short",  // Too short
  "email": "not-an-email",  // Invalid format
  "age": 12,  // Below minimum
  "terms_accepted": false  // Required to be true
}

Tools Used in This Guide

JSON Schema Validator Comparison

FeatureFindUtilsjsonschemavalidator.netjsonlint.comcodebeautify.orgliquid-technologies.com
Schema ValidationYesYesNoLimitedYes
Schema GenerationYesNoNoNoYes (paid)
Draft 7 SupportYesYesN/AN/AYes
Detailed Error MessagesYesYesBasicBasicYes
Client-Side ProcessingYesNoNoNoNo
No Signup RequiredYesYesYesYesPartial
Ad-FreeYesNoNoNoYes
PriceFreeFree (ads)Free (ads)Free (ads)Free trial / $99+

FindUtils is one of the few online tools that offers both schema validation and schema generation in the same platform. Processing happens entirely in your browser, which means your API schemas and test data remain private — unlike server-side validators that transmit your payloads.

FAQ

Q1: What's the difference between JSON Schema Draft 4, 6, 7? A: Newer versions add more keywords and flexibility. Draft 7 (2018) is current. Most modern validators support it. Choose based on your requirements.

Q2: Can I use JSON Schema in my API? A: Yes! Many API frameworks (Express, FastAPI, etc.) have schema validation libraries. Validate on the server side to ensure data quality.

Q3: Is JSON Schema just for validation? A: It's primarily for validation, but also used for API documentation generation, testing, and code generation.

Q4: Can I validate arrays? A: Yes! Use "type": "array" with "items" to define what each element must look like:

JSON
1
2
3
4
5
6
7
{
  "type": "array",
  "items": {
    "type": "object",
    "properties": { "name": { "type": "string" } }
  }
}

Q5: Should I auto-generate or write schemas manually? A: Auto-generate to get started, then manually refine. The generator gives you structure; you add constraints.

Next Steps

Validate with confidence! ✅