JSON Schema Validation Explained: Validate JSON Against a Schema Online
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:
{
"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 idmust be an integernameandemailmust be stringsemailmust be a valid email formatagemust be between 0 and 150id,name, andemailare 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
| Keyword | Purpose | Example |
|---|---|---|
type | Data type | "type": "string" |
properties | Object properties | "properties": { "name": {...} } |
required | Required fields | "required": ["id", "name"] |
Constraint Keywords
| Keyword | Purpose | Example |
|---|---|---|
minimum | Minimum value | "minimum": 0 |
maximum | Maximum value | "maximum": 100 |
minLength | Minimum string length | "minLength": 3 |
maxLength | Maximum string length | "maxLength": 50 |
pattern | Regex pattern | "pattern": "^[a-z]+$" |
enum | Allowed values | "enum": ["active", "inactive"] |
format | Special formats | "format": "email" |
Type Constraints
{
"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:
{
"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:
{
"username": "johndoe",
"password": "securePassword123",
"email": "john@example.com"
}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
{
"user": {
"id": 123,
"name": "John Doe",
"email": "john@example.com",
"age": 30,
"active": true,
"tags": ["admin", "developer"]
}
}Step 2: Generate Schema
Open the findutils.com JSON Schema Generator and the tool infers the schema:
{
"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:
{
"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:
{ "type": "integer" }Invalid Data:
"123" // String, not integer
Fix: Use the correct type: 123 (without quotes)
Error: Missing Required Field
Schema:
{
"properties": { "email": { "type": "string" } },
"required": ["email"]
}Invalid Data:
{ "name": "John" } // Missing emailFix: Include all required fields
Error: Value Out of Range
Schema:
{
"type": "integer",
"minimum": 0,
"maximum": 100
}Invalid Data:
150 // Exceeds maximum
Fix: Use a value between 0 and 100
Error: Invalid Format
Schema:
{
"type": "string",
"format": "email"
}Invalid Data:
"john.example.com" // Missing @
Fix: Use valid email: "john@example.com"
Practical Example: User Registration API
Your API accepts user registration with this schema:
{
"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:
{
"username": "john_doe123",
"password": "securePassword123",
"email": "john@example.com",
"age": 25,
"terms_accepted": true
}Invalid (multiple errors):
{
"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 — Validate data against a schema online
- JSON Schema Generator — Auto-generate schemas from sample JSON data
JSON Schema Validator Comparison
| Feature | FindUtils | jsonschemavalidator.net | jsonlint.com | codebeautify.org | liquid-technologies.com |
|---|---|---|---|---|---|
| Schema Validation | Yes | Yes | No | Limited | Yes |
| Schema Generation | Yes | No | No | No | Yes (paid) |
| Draft 7 Support | Yes | Yes | N/A | N/A | Yes |
| Detailed Error Messages | Yes | Yes | Basic | Basic | Yes |
| Client-Side Processing | Yes | No | No | No | No |
| No Signup Required | Yes | Yes | Yes | Yes | Partial |
| Ad-Free | Yes | No | No | No | Yes |
| Price | Free | Free (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:
{
"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
- Compare JSON files to spot schema violations
- Learn JSON conversion for interoperability
- Return to the complete JSON tools guide
Validate with confidence! ✅