JSON → JSON Schema
Generate a draft 2020-12 or draft-07 style JSON Schema from a JSON sample, with $schema, type, properties, items, required and additionalProperties; mixed arrays use items.anyOf.
Inputs and parameters
input— JSON inputtitle— Schema titledialect— DialectrequireAll— List every sample key as required
Real example
{"id":1,"active":true,"deleted":null,"tags":["a",2]}
→ {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Root",
"type": "object",
"properties": {
"id": { "type": "integer" },
"active": { "type": "boolean" },
"deleted": { "type": "null" },
"tags": { "type": "array", "items": { "anyOf": [{ "type": "string" }, { "type": "integer" }] } }
},
"additionalProperties": false,
"required": ["id", "active", "deleted", "tags"]
}
Limits and failure handling
Inference does not guess format, enum, minimum or pattern constraints. additionalProperties:false is a conservative sample-shape choice and may reject future fields. Empty arrays get an intentionally open items object with a note. Large integers are typed integer with a precision note; losslessness is never claimed.
FAQ
What changes between draft-07 and 2020-12?
Only the $schema URI changes; type/properties/items/anyOf/required/additionalProperties stay the same. The selected dialect is stated in both output and documentation.
Why are all keys required by default?
A single sample cannot distinguish required from merely present. All sample keys are required by default; unchecking the option omits required instead of guessing.
Does it validate arbitrary instances?
This tool only generates Schema text and does not embed a validator. Download the .schema.json and use it with a draft-compatible validator.