JSON Schema Generator
Turn one real payload into a schema you can actually enforce.
About this tool
Generate a JSON Schema from a sample payload. The schema describes what your sample actually contains — every property typed, arrays described by their items, nesting followed all the way down.
Choose the draft (2020-12 by default; draft-07 for older toolchains), whether every property is required, and whether objects reject properties the sample did not show. Those three choices are where schema generators usually impose opinions silently; here they are controls on the toolbar.
Integers beyond 2⁵³−1 are typed integer or string, because a validator that reads them as numbers would round them — the note under the output says when this fired.
How to use it
- Paste a real payload — one that shows every field, including optional ones if you can.
- Pick the draft and the strictness: all-required, and whether to reject undeclared properties.
- Copy the schema into your project, or take it straight to the schema validator to see it accept the sample it came from.
Worked example
The sample above becomes an object schema with user, roles and active properties — user an object with string members, roles an array of strings, active a boolean — nested to exactly the depth the sample shows.
One sample, one enforceable schema