ToyTools Guide
What a JSON Example Can Tell a Schema
Draft a schema from the types in one JSON example. Required fields are not inferred. Runs entirely on your device. Nothing is uploaded.
Quick Answer
A JSON schema generator here is an example schema. What can one JSON example tell a schema? The json types that appear, and the object properties that appear. A string example is not a format.
Open JSON to JSON Schema →Why it matters
For example, a minified payload is hard to check by eye. A schema of the types lets you see the shape before you write the checks yourself.
How it works
How to draft a schema from a sample payload: paste one JSON value. What is an integer versus a number here? A whole number is integer. A fraction is number. How to read an empty array in the result: the type is array, and items is absent, because the example showed no elements.
A type from an example vs a required field: presence in one object does not mean required. JSON Schema vs JSON validation is the next page. This one only drafts the types.
Common Mistakes
Related Tools
You May Also Need
You may also need
- JSON Schema ValidatorCheck another value against the schema you just drafted
- JSON FormatterPretty-print the example before reading the schema
Alternatives
- JSON ValidatorCheck that the text is JSON before drafting a schema