JSON Sample → JSON Schema
Infer a Draft 2020-12 JSON Schema from a sample value or array of objects, with auto-detected formats.
JSON Schema (Draft 2020-12)
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"email": {
"type": "string",
"format": "email"
},
"active": {
"type": "boolean"
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
},
"profile": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"age": {
"type": "integer"
}
},
"required": [
"age",
"name"
],
"additionalProperties": false
},
"lastLogin": {
"type": "null"
}
},
"required": [
"active",
"email",
"id",
"lastLogin",
"profile",
"tags"
],
"additionalProperties": false
}How it infers
Each field gets the narrowest JSON Schema type that fits every observed sample. Arrays of objects merge into a singleitems shape — keys present in some samples but not others are dropped from required. Integers stayinteger until they meet a float, then promote tonumber.
Multiple samples
Pass an array of objects at the top level to widen the schema — very useful for shaping API responses from a handful of fixture payloads.
You might also like
- JSON Sample → Zod SchemaGenerate a z.object({...}) schema with inferred TypeScript type from any JSON sample. Detects UUID/email/URL/date formats.
- .gitignore BuilderPick languages, frameworks, build tools, editors and OS — get a deduped .gitignore.
- .gitignore GeneratorBuild a .gitignore by picking from common language, framework, and OS templates.
- Dockerfile StarterMulti-stage Dockerfiles for Node, Python, PHP, Go, Ruby, Rust, Java, and static sites — plus matching .dockerignore.