JSON Schema
Generate a JSON Schema draft 2020-12 from one JSON sample. Large integers stay integers.
Added 2026-10-24
What it does
JSON Schema builds a draft 2020-12 schema from one JSON sample. Fields on an object become properties, and every field that appears is required. Objects in an array are merged, and a field missing from some items is not required. A field that never appears is not invented. Put several objects in an array when you want that merge. Integers bigger than Number.MAX_SAFE_INTEGER stay type integer, with their digits intact. The schema describes this sample shape. Sample values are copied in only if you turn on examples. This page does not check a later document against the schema. That is the validator.
How to use it
- Paste one JSON value. Objects become properties, and every field in that sample is required.
- Objects in an array are merged. A field that is missing from some items is not required.
- The schema describes the sample's shape. It does not copy the sample unless you turn on examples.
Common mistakes
- A sample cannot show a missing field. If a field never appears in the sample, it will not be in the schema. Merge several objects by putting them in an array.
- Large integers stay integers. A number bigger than Number.MAX_SAFE_INTEGER is still type integer. The digits are not rounded.
The JSON stays in this tab. It is not uploaded.
Related guides
- A JSON sample is not a schema
A schema generated from one sample describes that sample. Validation checks a document, and remote $ref is not loaded.
- JSON integers past 2^53
Why JSON.parse rounds large integers, and how to keep every digit when you only need to format JSON.
Related tools
- JSON to TypeScriptDataInfer interfaces from JSON. Nested objects, array unions, null, and optional fields.
- JSON FormatterDataFormat and validate JSON in your browser. Large integers keep every digit.
- JSON Schema ValidatorDataCheck JSON against a schema you paste. Draft 2020-12 and draft-07. Nothing is uploaded.