JSON to JSON Schema
Turn a sample document into a JSON Schema. Repeated object shapes are hoisted into $defs and referenced, so the output stays readable even for a large response.
Output appears here as you type.
Runs entirely in your browser. Nothing you paste here is uploaded or stored.
Questions
Is my JSON uploaded anywhere?
No. Inference and code generation run entirely in your browser. Nothing is sent to a server, so pasting a real API response with customer data or internal URLs is safe.
Should I paste one object or an array of them?
An array, whenever you have one. Every element is merged into a single shape, so a field that is missing from some records becomes optional and a field that is sometimes null becomes nullable. One object can only ever tell the generator that everything is required.
Should I set additionalProperties to false?
Usually not. It rejects any field that was not in your sample, which means the schema breaks the first time the API adds one. Turn it on only when you genuinely control both ends and want a closed contract.
Which draft should I pick?
Draft 2020-12 unless a tool in your pipeline requires otherwise. It uses $defs; draft-07 uses definitions, and expresses nullable references as an anyOf composition because a $ref cannot carry sibling keywords.
More code generation tools
JSON → TypeScript
Generate named interfaces, with optionals and nullability inferred from every sample.
JSON → Zod
Generate a Zod schema, with formats, enums and optionals already applied.
JSON → Go
Generate Go structs with json tags, pointers for optional fields, and gofmt spacing.
JSON → C#
Generate C# classes or records with nullable annotations and serializer attributes.
JSON → Python
Generate Pydantic models or dataclasses, with aliases and correct field ordering.
JSON → Java
Generate Java records or POJOs with Jackson annotations and correctly boxed types.
JSON → Rust
Generate serde structs with Option, rename attributes and rustfmt spacing.