ToolConvoyToolConvoyv2.6
DATA

JSON Schema Generator — Generate JSON Schema from Sample Data

Generate JSON Schema (Draft 2020-12) from sample JSON data. Auto-infers types, formats, and required fields. Runs in your browser. No uploads, no limits.

● LOCAL · ZERO-COPY PIPELINE0 network requests from tools since page load

JSON Schema Generator

Generate a JSON Schema from sample JSON data. The tool infers types, detects required fields, and handles nested objects and arrays. Supports JSON Schema draft 2020-12. Works entirely in your browser.

JSON Schema is the standard way to describe the shape of JSON data. It serves the same role that TypeScript interfaces, Go structs, and Python type hints serve for typed languages: a machine-readable description of what fields exist, what types they have, what values are allowed, and which fields are required. The difference is that JSON Schema is itself JSON, so it can be stored, transmitted, and processed with the same tools that handle the data it describes. The current spec is Draft 2020-12, which adds recursive types, conditional schemas, and a number of refinements over the older Draft 7 and Draft 4 specs.

Generating a schema from sample data is the standard starting point. The alternative — writing the schema by hand — works for small, well-known data shapes, but for a real-world API with dozens of endpoints and hundreds of fields, hand-writing is impractical. Inference from sample data is the right starting point, with the caveat that the inference is only as good as the sample. A field that appears in every sample row is required; a field with a single string value in the sample is inferred as a string. The inference does not know that the field is supposed to be an enum, or that the string is supposed to match a regex pattern, or that the array is supposed to have a minimum length. Those constraints are added by hand after the inference.

For a final hand-off: if the destination is API documentation (OpenAPI, Swagger), the generated schema is the starting point — add descriptions, examples, and constraints to make it production-ready. If the destination is a typed language client (TypeScript, Go, Rust, C#, Java), feed the JSON Schema into a code generator like quicktype to produce the matching types. If the destination is a runtime validator (ajv in JavaScript, jsonschema in Python, networknt in Java), the schema is the input — validate incoming data against it before processing. The generated schema is a strong starting point but is not a substitute for human review.

Advertisement

How to use

  1. Paste your sample JSON

    Drop a JSON document or a JSON array of documents into the input. The schema generator walks the data, infers types, and detects required fields based on which keys appear in every object.

  2. Pick inference options

    Toggle 'detect format' to enable format hints (email, date-time, uri, uuid) for string values that match common patterns. Toggle 'merge examples' to include the source data as `examples` in the schema.

  3. Copy or download the schema

    Copy the generated JSON Schema to your clipboard, or download it as a .json file. The output is Draft 2020-12 compatible and validates in any modern schema validator.

Frequently asked

How are required fields determined?

A field is marked as required if it appears in every object in the sample. If the sample is a single object, every key is required. If the sample is an array of objects, only the keys common to all objects are required. Add more sample data to make the inference more accurate.

Can it detect string formats?

Yes — when 'detect format' is enabled, string values are tested against common patterns. `2023-01-15T10:30:00Z` becomes `format: date-time`, `[email protected]` becomes `format: email`, `https://example.com` becomes `format: uri`. The detection is conservative — a single mismatch disables the format hint for that field.

What about nested objects and arrays?

Will the schema be valid for validation?

Yes — the output is Draft 2020-12 compatible and passes validation in ajv, jsonschema (Python), and other modern validators. For older validators that only support Draft 7 or Draft 4, post-process the output to remove 2020-12-specific keywords (`prefixItems`, `if/then/else`, etc.).

Can I edit the generated schema?

Yes — the generated schema is regular JSON. Add constraints (minLength, maximum, pattern), add `description` fields for documentation, or adjust the inferred types. The output is a starting point, not a finished schema — review it before treating it as the source of truth for your data shape.

Limitations

  • Inference is only as good as the sampleA field inferred as a string from the sample may actually be a number with one bad row. The schema reflects what the sample shows, not what the data is supposed to be. Validate the schema against multiple real-world samples before treating it as the source of truth.
  • No union types inferredA field that contains both a string and a number in the sample is inferred as the first type seen, not as a union (`oneOf` or `anyOf`). For polymorphic data, generate multiple schemas from homogeneous samples and combine them by hand.
  • No reference deduplicationIf the same object shape appears in multiple places, the schema generates a separate `properties` block for each occurrence. For shared schemas, refactor manually using `$ref` to point to a single definition.

Platform notes

macOS
For command-line work, Python's `gen-jsonschema` and `inferjson` do similar inference. The browser tool is the right pick for one-off schema generation where installing Python packages is not worth the setup time.
Windows
PowerShell cannot generate JSON Schema natively. The browser tool is the right pick for ad-hoc schema generation; for build pipelines, use the `quicktype` CLI or a Python-based generator.
Linux
`quicktype --lang schema --top-level PascalCase` is the standard CLI equivalent for many languages. The browser tool is the right pick for one-off schema generation of JSON pasted from a chat or an API response.
Web
Runs entirely client-side. Works offline once the page has loaded. Useful for restricted environments where command-line tools or a Python install are not available.
Advertisement
Advertisement