JSON Schema Generator
Guide: How to Fix the Most Common JSON Errors
For the best schema, use a list of several example objects so optional keys are spotted.
Nothing you enter or choose here leaves your device. This tool runs in your browser.
How to use
- 1Paste a sample JSON document, or a list of examples.
- 2Choose whether to detect formats, mark required keys and block extra properties.
- 3Read the generated schema.
- 4Click Copy schema.
Frequently asked questions
How does it work out the schema?
It reads the types of your sample, merges the items of any list, and notes which keys appear in every object. A list of several examples gives the best result.
What does detecting formats do?
It adds a format keyword, such as email, date, date-time, uuid, uri or ipv4, when every string in a field matches that pattern.
Which JSON Schema version is used?
Draft 2020-12. You can remove the $schema line if your tool expects another draft. Basic keywords such as type, properties, required and items work in all drafts.
Can I validate data with it?
Yes. Use the schema with a validator such as Ajv in JavaScript, jsonschema in Python or any OpenAPI tooling. Treat the result as a starting point and tighten it by hand.
Read the guides
Learn how this works and how to get the most from it.
Developer
How to Fix the Most Common JSON Errors
Trailing commas, single quotes, unquoted keys and more. Learn to read a JSON error message and fix invalid JSON quickly.
1 min read
Developer
Turn JSON or XML Into Classes (DTOs) in Java, C# and More
What a DTO is, how generated classes map JSON and XML, and the details to check before you trust a generated model.
1 min read
Related tools
JSON Formatter & Validator
Prettify, minify and validate JSON, with error line numbers.
JSON to DTO Generator
Turn JSON into Java, C#, TypeScript, Kotlin, Python or Go classes.
JSONPath Tester
Test JSONPath queries against your JSON and see every match.
JSON Diff
Compare two JSON documents and see what changed, ignoring key order.