JSON Schema Builder
Generate a JSON Schema or MongoDB $jsonSchema from a form, with live validation
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 this tool
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
What is the difference between the JSON Schema and the $jsonSchema output?
The JSON Schema tab emits a standard draft-07 schema; the MongoDB tab wraps the equivalent validator in { "$jsonSchema": { ... } } and maps types to bsonType aliases (e.g. integer → int, boolean → bool) for db.runCommand({ collMod }).
Does the Test tab use the same rules as the NoSQL Validator?
Yes — the test document is validated against the generated schema with the same engine, so what you see here matches the standalone validator.
Is my schema or sample data uploaded?
No. The builder and validator run entirely in your browser. Nothing leaves this tab.
Related guides
Build MongoDB Queries Without Memorizing Operators
Find filters and aggregate pipelines from visual rows — $eq, $in, $regex, $exists, and how AND/OR logic maps to $and and $or arrays.
Validate MongoDB Documents With $jsonSchema
Stop bad documents at the door. Build a JSON Schema or MongoDB $jsonSchema visually, validate documents against it, and apply it as a collection validator — all in your browser.
References & standards
Related tools
Base64 Toolbox
Professional Base64 workspace for text, files and images with Base64URL, MIME, Data URI, strict validation, image preview and ready-to-use snippets.
C# to VB.NET Converter
Convert a subset of C# — classes, methods, variables, loops — into VB.NET
CSV Data Viewer
Paste CSV and browse rows in a sortable table with delimiter detection
CSV to Chart
Paste or upload CSV data and generate bar, line, pie, or doughnut charts. Export as PNG.
CSV to JSON Converter
Paste CSV data and convert it to pretty-printed JSON instantly — supports custom delimiters, header row toggling, and value trimming.
CSV to Markdown Converter
Convert CSV to a Markdown table and Markdown tables back to CSV