JSON Schema Builder
Generate a JSON Schema or MongoDB $jsonSchema from a form, with live validation
Properties
Test document
The document matches the generated MongoDB schema.
Generated schema
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"email": {
"type": "string",
"description": "User email address",
"pattern": "^[^@]+@[^@]+\\.[^@]+$"
},
"age": {
"type": "integer",
"description": "Age in years",
"minimum": 0,
"maximum": 150
},
"role": {
"type": "string",
"enum": [
"admin",
"editor",
"viewer"
]
}
},
"required": [
"email",
"age"
]
}Examples
A user document schema
email (string, required, pattern), age (integer, required, 0–150), role (enum)A draft-07 JSON Schema and the matching MongoDB $jsonSchema with required fields and constraints.The form starts with a sensible example — adjust it and both schema formats update live.
Validate before you deploy
{ "email": "ada@example.com", "age": 36, "role": "editor" }VALID — the test document matches the generated $jsonSchema.The Test tab validates a sample document against the generated schema so you catch mistakes before applying it to a collection.
About this tool
A schema is the cheapest way to stop bad documents reaching your store, but writing JSON Schema or MongoDB's $jsonSchema by hand is fiddly — one wrong keyword silently lets invalid data through.
This builder turns a form into a correct schema: add properties, pick a type, mark which are required, and add constraints such as string patterns, numeric minimum/maximum, and enum lists. It emits both a standard draft-07 JSON Schema and the equivalent MongoDB $jsonSchema validator, and you can validate a test document against the generated schema live before you deploy it.
How to use
Add properties
Click Add property, name the field, pick its type, and tick required where needed.
Add constraints
Set a pattern for strings, minimum/maximum for numbers, or an enum list for any type.
Copy the output
Use the JSON Schema or MongoDB $jsonSchema tab and copy the generated schema.
Test a document
Paste a sample document on the left to confirm the schema accepts what you expect and rejects what it shouldn't.
Common mistakes
Mistake:Listing a property but forgetting to mark it required.
Fix:Tick the 'required' checkbox — properties are optional unless you add them to the required list.
Mistake:Using the wrong bsonType for MongoDB.
Fix:The builder maps each type to the correct bsonType alias (e.g. integer → int, boolean → bool) automatically.
Frequently asked questions
Related guides
References & standards
Related tools
Lighthouse Audit Summary
Summarize a Lighthouse report into prioritized actions. Enter category scores or paste Lighthouse JSON to get grades, weakest areas, and a ranked improvement checklist.
SSL Chain Analyzer
Paste a PEM certificate bundle and verify the chain order — find missing intermediates, broken links, expired or not-yet-valid certificates, self-signed roots, and duplicates. All in-browser.
SQL Injection Detector
Scan an input string or query for SQL injection signatures — tautologies, UNION SELECT, stacked queries, time-based blind, comments, and destructive statements — with a risk score and classification.
NoSQL Validator
Validate a JSON document against a JSON Schema or MongoDB $jsonSchema. Get clear, path-precise errors for missing fields, wrong types, patterns, ranges, and disallowed properties.
SQL Performance Analyzer
Paste a SQL query to find performance anti-patterns — SELECT *, leading-wildcard LIKE, missing WHERE, cross joins, NOT IN, functions on columns — with a score and ranked fixes.
Redis CLI Simulator
Practice Redis commands in an in-browser terminal. Run GET, SET, HSET, LPUSH, SADD, ZADD, EXPIRE, KEYS and more against a local store — no Redis server required.