DevTools Logo

JSON Schema Sample Data Generator

JSON Schema Sample Data Generator

Walk a JSON Schema and generate seeded, constraint-aware sample JSON. Nothing leaves your browser.

Runs in your browser
Try an example

JSON Schema

Generated samples

No samples yet

Load an example schema or paste your own — generation is deterministic for a given seed.

Details

Paste a draft-07, 2019-09 or 2020-12 schema and generate up to 50 sample instances. The walker honors types, enums, const, required properties, string lengths, numeric bounds, multipleOf, array sizes, uniqueItems, formats such as email/uuid/date-time, allOf/oneOf/anyOf and internal $ref with a recursion depth cap. A seed makes every run reproducible, and a bundled validator checks each sample against the supported keyword subset before showing it. External $refs and regex patterns are reported as unsupported rather than silently ignored.

More examples

API fixture from a contract

{ "type": "object", "required": ["id", "email"], "properties": { "id": { "type": "string", "format": "uuid" }, "email": { "type": "string", "format": "email" } } }

Three samples yield valid-looking UUIDs and addresses for Postman or a test suite.

Branch coverage with oneOf

{ "oneOf": [{ "const": "card" }, { "const": "bank" }, { "const": "cash" }] }

The branch rotates with the sample index, so four samples exercise all three payment methods.

Reproducible CI data

Seed: fixtures-v1 · Samples: 5 · Download: samples.ndjson

The same seed and schema always produce byte-identical samples, so fixtures never drift between runs.

Examples

Contract fixture

Input
{ "type": "object", "required": ["id"], "properties": { "id": { "type": "string", "format": "uuid" } } }
Output
[ { "id": "7c2d…" }, … ]

The UUID format produces syntactically valid identifiers, three samples by default.

Branch rotation

Input
{ "oneOf": [{ "const": "card" }, { "const": "bank" }] }
Output
["card", "bank", "card"]

Increasing the sample count cycles through the declared alternatives.

About this tool

JSON Schema Sample Data Generator turns a schema contract into concrete example instances. It walks types, enums, const values, required properties, string lengths, numeric bounds, array sizes and format hints, then checks every generated sample against the supported keyword subset before showing it.

A seed hashes to a deterministic 32-bit stream, so the same schema and seed always produce the same samples — handy for checked-in fixtures and reproducible bug reports. oneOf/anyOf branches rotate with the sample index to cover alternatives, and internal $ref pointers resolve with a recursion depth cap. Everything runs locally; no schema is uploaded.

What this tool does not do

  • External $refs are rejected with a clear error; only internal #/... pointers are resolved.
  • Regex `pattern` values are not synthesized and are reported in the warnings strip.
  • Recursion is capped at depth 3 and uses a minimal legal value to terminate cycles.
  • Standalone `not` constraints cannot be enforced by the generator.

How to use this tool

  1. Paste a schema

    Paste a draft-07, 2019-09 or 2020-12 JSON Schema. The draft chip shows which dialect was detected.

  2. Choose seed and count

    Set a seed string and a sample count from 1 to 50. Identical settings always produce identical samples.

  3. Review validation

    Check the valid/flagged stats and warnings strip for unsupported keywords or unsatisfiable constraints.

  4. Export fixtures

    Copy the array, download samples.json, or download NDJSON for a fixture pipeline.

Use cases

Mock server payloads

Turn an OpenAPI-derived component schema into realistic responses for a local mock API.

Test fixtures in CI

Commit a seed and schema pair so regenerated fixtures never produce noisy diffs.

Documentation examples

Generate valid-looking sample payloads for endpoint docs without hand-maintaining them.

Supported schema keywords

KeywordBehavior
type / enum / constPrimitive dispatch, enum values cycle across samples, const is emitted verbatim.
required / propertiesRequired keys are always generated; optional keys are sampled.
minLength / maxLengthGenerated words are padded or truncated to the requested bounds.
minimum / maximum / multipleOfNumbers respect bounds and are snapped to multiples without float drift.
items / minItems / maxItems / uniqueItemsArrays get a bounded item count and retry to make values unique.
formatemail, uuid, date-time, date, time, uri, hostname, ipv4/ipv6, json-pointer and regex hints are recognized.
allOf / oneOf / anyOfallOf constraints merge; oneOf/anyOf branches rotate across samples.
$refInternal #/definitions and #/$defs pointers resolve; recursion stops at depth 3.

External $refs, regex `pattern` synthesis and standalone `not` are reported as warnings or errors rather than silently ignored.

Common mistakes

Mistake:Expecting every JSON Schema keyword to be enforced.

Fix:The generator covers a documented subset; pattern, not and external $ref produce explicit warnings or errors.

Mistake:Using an external $ref URL.

Fix:Inline the referenced definitions under $defs or definitions — remote resolution is deliberately unsupported.

Mistake:Assuming realistic mode invents real people.

Fix:All names, domains and addresses come from small fictional pools; the data is synthetic.

Frequently asked questions

Which JSON Schema drafts are supported?

The generator detects draft-07, 2019-09 and 2020-12 schemas and walks the shared keyword subset: types, enum, const, required, properties, bounds, formats, allOf/oneOf/anyOf and internal $ref. Draft-specific keywords outside that subset are reported rather than silently misinterpreted.

Are the generated samples guaranteed to be valid?

Every sample is checked with a bundled validator covering the supported keywords, and invalid samples are regenerated up to three times with an attempt-specific seed. Samples that still fail are shown with a reason in the warnings strip, so the validity status is never hidden.

How does seeding work?

The seed string is hashed to a 32-bit integer that drives a mulberry32 pseudo-random stream. The same schema, seed and sample count always produce byte-identical output. Each sample and retry uses a derived stream, so changing the count does not reshuffle earlier samples.

Can it handle oneOf and anyOf?

Yes. Branches rotate with the sample index, so asking for more samples than branches exercises each alternative. allOf constraints are shallow-merged before generation; standalone not constraints cannot be enforced and are flagged with a warning.

What about pattern properties and external refs?

One patternProperties entry per object is sampled with a synthesized key. External $refs (http/https) are rejected with an error that asks you to paste the referenced schema inline, because the tool never fetches anything from the network.

References & standards