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".
All keys present in the sample are marked as required by default. You’ll probably want to adjust that, some fields might be optional in practice, but the structural boilerplate is done for you.
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?
Inferred from the first element. Empty arrays don’t generate an items schema.
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.