AIWalay Tools

JSON Schema Generator

Generate a draft-07 JSON Schema from sample JSON automatically — infers types, required fields and nested structures. Copy or download.

About the JSON Schema Generator

This JSON Schema generator infers a complete draft-07 schema from a sample JSON document. Paste an example object or array and it derives the type of every field, marks present keys as required, describes nested objects and arrays, and merges shapes across array items so optional fields are detected automatically.

Writing schemas by hand is tedious and error-prone; starting from real data is far faster. The generated schema is a solid first draft you can refine — adding descriptions, formats, enums and constraints — for API validation, form generation and documentation.

Everything runs locally in your browser, so your sample data never leaves your machine.

How to Use the JSON Schema Generator

  1. 1Paste a representative JSON sample.
  2. 2Click Generate schema to infer a draft-07 schema.
  3. 3Review the types and required fields, then refine as needed.
  4. 4Copy the schema or download it as a .json file.

Frequently Asked Questions

Which JSON Schema version does it produce?

It outputs draft-07, the most widely supported version across validators and tooling. The schema includes the $schema declaration, type keywords, properties, required arrays and items definitions, which are compatible with most later drafts too.

How are optional fields detected?

When you provide an array of objects, the generator merges their shapes: a key present in every item is marked required, while a key missing from some items becomes optional. Providing several representative examples yields a more accurate schema.

Does it infer formats like email or date?

No — it infers structural types (string, number, integer, boolean, object, array, null) but not semantic formats, since those can't be reliably guessed from a value. Add format: 'email' or 'date-time' and other constraints manually after generating.

Can I validate data against the generated schema?

Yes. Take the output to the JSON Schema Validator tool or any standard validator (Ajv, jsonschema) to check documents against it. The generated schema is a starting point — tighten it with required fields, enums and limits for production validation.

Is my sample data uploaded?

No. Inference happens entirely in your browser, so the sample JSON is never transmitted or stored. It's safe to paste real data while designing a schema.

Related Tools