Generate a JSON Schema from example data
Writing JSON Schema by hand for a 30-field object with nested arrays is mind-numbing work. You know the structure, you have a sample document, why can’t something just infer the schema from it?
That’s what this does. Paste a representative JSON document, click generate, and you get a draft-07 schema with types, required fields, and format annotations (email, date-time, uri) detected automatically. Copy it into your OpenAPI spec, validation middleware, or code generator.
What it infers
The tool walks your JSON recursively. Strings become "type": "string". Numbers become "type": "integer" or "type": "number". Booleans, null, objects, arrays, all mapped correctly. It also sniffs common patterns: if a string looks like an email address, it adds "format": "email". ISO dates get "format": "date-time". URIs get "format": "uri".
Keys are marked required when every object at that spot has them. Paste an array where record 1 has note and record 2 doesn’t, and note lands in properties but stays out of required. A field that is sometimes null gets a type pair like ["string", "null"], and a mix of 10 and 9.99 becomes number. Your whole sample always validates against the schema it produced, including with additional properties switched off.
Where you’ll plug this schema in
API validation: Express, Fastify, or any middleware that accepts JSON Schema can validate request bodies against it.
OpenAPI/Swagger: drop the schema into your API spec to document request and response shapes.
Form validation: libraries like Ajv and react-jsonschema-form use JSON Schema to drive client-side validation.
Code generation: tools like quicktype and json-schema-to-typescript turn schemas into TypeScript interfaces, Go structs, or Python dataclasses.
Data contracts: in microservice architectures, schemas define what producers and consumers agree on.
It’s a starting point, not the final draft
The tool can’t infer constraints like minLength: 3, maximum: 100, or enum: ["active", "inactive"] from a single example. Add those business rules manually. The generator gives you the structural skeleton so you can focus on the domain-specific parts.
FAQ
Which schema version?
Draft-07, the most widely supported across validators in all major languages.
How are arrays handled?
From every element, not just the first. Item types are merged, objects in the array share one properties list, and an empty array gets an open items schema that accepts anything.
Does it detect string formats?
Yes, email, URI, date, and date-time patterns are annotated automatically.
Client-side?
Everything runs in your browser. Your data stays private.