JSON Schema Validator / Generator: Validate JSON Contracts or Infer a First Draft Schema
A json schema validator helps you answer one question clearly: does this JSON match the schema you expect? A json schema generator helps with a different question: given this sample JSON, what schema would describe it? Putting both tasks in one tool is useful because developers often move back and forth between validation and generation while designing or debugging an API contract.
This tool is practical for request bodies, webhook payloads, config files, fixture data, and internal data exchange formats. Paste JSON, validate JSON against schema, or generate a schema from example data and refine it from there. Toolzy.dev performs the work locally in the browser, so your JSON and schemas stay on your machine.
The big caveat is that validation and generation are not the same thing. Validation checks data against an explicit contract. Generation infers a draft contract from examples. Those are related workflows, but they have different confidence levels and different failure modes.
What validation does vs what generation does
Validation starts with a schema and asks whether the data fits. If your schema says age is an integer and the JSON contains "age": "42", validation should fail.
Generation runs the other direction. It looks at sample JSON like:
{ "name": "Ada", "age": 42 }
and infers a possible schema:
{
"type": "object",
"properties": {
"name": { "type": "string" },
"age": { "type": "integer" }
},
"required": ["name", "age"]
}
That generated result is often a solid starting point, but it is still inferred from the sample, not guaranteed by a broader contract.
Using it
To validate, paste your JSON and your schema, then run validation and inspect the reported errors. To generate, paste representative JSON, generate a schema, then review required fields, array item definitions, and inferred primitive types before copying it into your project.
This tool uses JSON Schema Draft 2020-12 for validation and for generated starter schemas. That matters because keywords and behavior can differ across drafts, so keep the draft visible when you move the result into downstream tooling.
Be explicit about schema draft support
JSON Schema is a family of specs, not one frozen format. Draft-07 is still common. Draft 2019-09 and Draft 2020-12 added newer conventions and keywords. This tool keeps the Draft 2020-12 choice visible because “valid in one validator” is not always identical to “valid everywhere.”
If you are generating a schema for use with Ajv, OpenAPI-adjacent tooling, or internal platform validators, check that those systems accept Draft 2020-12 before treating the output as final.
Sample-based generation has sharp edges
A generate json schema from json workflow is only as good as the sample. That creates predictable weak spots:
- empty arrays do not reveal item shape
- one example cannot prove whether a field is optional or just absent in that sample
- mixed values may cause broad unions like
string | number - date-looking strings are still strings unless you add format constraints manually
- enums are not discovered reliably from one or two values unless you choose to tighten them yourself
This matters most for arrays, unions, optionals, and formats. If one payload contains [], the generator cannot guess whether the real array should contain objects, strings, or nested tuples. If one field is sometimes missing, the tool cannot infer optionality unless the sample set shows both cases.
Where this tool saves time in real projects
- validating webhook payload samples before they hit your app logic
- generating a first-pass schema for internal JSON config files
- checking whether test fixtures still match a contract after backend changes
- documenting API request and response shapes with machine-readable schemas
- exploring third-party payloads before writing a stricter hand-maintained schema
Validation errors are often better than parser errors
Plain JSON parsing only tells you whether the input is syntactically valid. Schema validation tells you whether the structure is acceptable. That difference is why validate json against schema is valuable in production workflows. A payload can be perfectly valid JSON and still be unusable because a required property is missing, a type is wrong, or an array item violates constraints.
Validation is where schemas become operational instead of just documentary.
Troubleshooting
The JSON is valid but validation still fails — That means the syntax is fine but the data does not match the schema. Check required fields, property types, array item definitions, and enum or format constraints.
The generated schema is too strict or too loose — That's common with sample-based generation. Review required fields, nullable values, unions, and empty arrays before treating the schema as authoritative.
Why does schema draft matter here? — Different JSON Schema drafts support different keywords and interpretation details. This tool uses Draft 2020-12, so make sure your downstream tooling accepts that dialect.
An empty array produced a vague item schema — That's expected. A generator cannot infer array item structure from []. Use a representative non-empty sample if you want better output.
Can generated schemas detect every optional field or union correctly? — No. Generation only sees the examples you provide. Fields that are sometimes absent, nullable, or polymorphic often need manual refinement.
Is my JSON uploaded anywhere? — No. Toolzy.dev runs validation and generation in the browser, so your JSON and schema stay local to your machine.