JSON Schema Generator Online – Generate Schema from JSON

Generate a reviewable JSON Schema from one sample document without uploading the data.

Runs locally
Ready to generate

Paste one valid JSON value to infer its current shape.

116 chars

Select dialect-neutral output or add the Draft 7 declaration for an explicit schema dialect.

0 chars

JSON Schema generation guide

How to generate JSON Schema from sample data

Paste one valid JSON value into the generator above to infer a schema for its current structure. VetaTool identifies objects, arrays, required properties, and primitive JSON types locally in your browser, then produces readable JSON Schema output for review.

Steps

  1. Paste one valid JSON object, array, or primitive value.
  2. Choose dialect-neutral or Draft 7 output, then select Generate Schema.
  3. Review required fields and heterogeneous array anyOf entries.
  4. Copy the generated schema, then add business constraints manually.

What the first generator release infers

Objects become schemas with properties and required keys based on the fields present in the sample. Numbers are separated into integer and number types, while strings, booleans, null values, arrays, and nested objects are inferred recursively.

Arrays with one repeated shape use a single items schema. Arrays containing distinct shapes use a deduplicated anyOf list so the generator does not silently discard observed item types.

A sample cannot reveal every business rule

One payload cannot prove whether a field is always required, whether a string is an email, or whether additional object properties should be rejected. The generated result is therefore a starting point rather than a complete application contract.

  • All fields present in the single object sample are initially marked required.
  • Empty arrays remain unconstrained because no item type was observed.
  • Formats, ranges, patterns, descriptions, and additionalProperties are not invented.

Choose dialect-neutral or explicit Draft 7 output

Dialect-neutral output keeps the conservative shared subset without a $schema declaration. Draft 7 output adds http://json-schema.org/draft-07/schema# while preserving the same sample inference rules.

Generation runs locally in the browser, so API samples and configuration data are not sent to a schema service.

JSON Schema generation example

The generator infers required object properties, an integer identifier, a string name, and homogeneous string array items.

Sample JSON

{
  "id": 1,
  "name": "Ada",
  "tags": ["admin", "editor"]
}

Generated schema

{
  "type": "object",
  "properties": {
    "id": { "type": "integer" },
    "name": { "type": "string" },
    "tags": {
      "type": "array",
      "items": { "type": "string" }
    }
  },
  "required": ["id", "name", "tags"]
}

Common questions

Frequently asked questions

Does the generator choose a JSON Schema draft?

You can keep dialect-neutral output or select Draft 7. Draft 7 adds the official $schema declaration; Draft 2020-12 remains a separate follow-up capability.

Why are all object fields marked required?

The generator currently receives one sample. Every field present in that object is marked required because the sample provides no evidence that the field is optional.

How are mixed arrays represented?

Distinct observed item schemas are deduplicated and placed under items.anyOf. Repeated values with the same inferred shape produce one shared items schema.

Does the generator detect email, date, or URI formats?

No. The initial generator treats those values as strings rather than guessing semantic formats from one example.

Is my sample JSON uploaded?

No. Parsing and schema inference run locally in your browser.