{ }jsonkit
Tools/Validate/JSON Schema Generator
Search tools…⌘K
Format
{ }JSON Formatter
≡→JSON Minifier
\"JSON Escape / Unescape
Validate
JSON Validator
±JSON Diff / Compare
§JSON Schema Generator
JWT Decoder
Convert
→csvJSON to CSV
csv→CSV to JSON
⇄ymlJSON ⇄ YAML
⇄xmlJSON ⇄ XML
→tsJSON to TypeScript
Query
$.JSONPath / JQ Tester
Generate
Mock JSON Data Generator
§

JSON Schema Generator

Infer a JSON Schema from sample data — or validate against one.
processes as you type · client-side
Sample
Upload
Mode
generatevalidate
⧉ Copy output ⌘C
Download
Share
Clear
Input219 B · paste or drop a file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Schema (draft 2020-12)
codetree
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", "required": [ "id", "name", "email", "active", "roles", "plan" ], "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "email": { "type": "string" }, "active": { "type": "boolean" }, "roles": { "type": "array", "items": { "type": "string" } }, "plan": { "type": "object", "required": [ "tier", "seats", "renews" ], "properties": { "tier": { "type": "string" }, "seats": { "type": "integer" }, "renews": { "type": "string" } } } } }
✓ valid (RFC 8259)219 B → 797 B0.0 msLn 1, Col 1UTF-8

About JSON Schema Generator

The JSON Schema generator infers a JSON Schema (draft 2020-12) from a sample document, and can also validate JSON against a schema you provide. It reads the shape of your data — types, properties, nesting and arrays — and writes a schema that describes it, saving you from authoring one by hand.

Both generating and validating run in your browser, so your sample data and schemas are never uploaded. It is free, instant and needs no account, which makes it safe to use with real API responses.

Use it to bootstrap a contract for an API, seed request-body validation, document a data structure, or check that incoming JSON conforms to an agreed schema before it enters your system.

How it works

Draft 2020-12 output

Generated schemas target JSON Schema draft 2020-12, the current standard, and include the $schema keyword so downstream validators know which dialect to use. Types are inferred as object, array, string, number, integer, boolean or null based on the sample values.

Required-property inference

Every property present in the sample object is inferred as required, since it is the only evidence available from one example. Trim the required array afterward for fields that are genuinely optional — one sample cannot tell the generator which keys may be absent.

Arrays and nested objects

For arrays, the generator inspects the elements and produces an items schema describing their shape; for nested objects it recurses, building properties and required lists at every level so the schema mirrors your structure exactly.

Validate mode

Switch to validate mode to check a JSON document against a schema. The second input holds the schema, and the tool reports whether the data conforms, calling out the properties or types that do not match.

Frequently asked questions

Which JSON Schema version does it generate?

Draft 2020-12, the current specification. The output includes the matching $schema declaration so validators interpret it correctly.

Why are all properties marked required?

The generator only sees one example, so it assumes every key it observed is required. Remove the genuinely optional fields from the required array yourself — a single sample cannot reveal which keys are sometimes missing.

Can one sample capture every case?

No. Provide a representative sample with all fields populated, then refine the schema by hand for optional fields, enums, formats and constraints the example could not express.

How do I validate data against a schema?

Switch to validate mode, put your schema in the second input and your data in the first. The tool reports whether the document conforms and highlights mismatches.

Is my sample data uploaded?

No. Both schema generation and validation run locally in your browser, so your data and schemas stay private.