DevTools Logo

JSON Schema Sample Data Generator

JSON Schema Sample Data Generator

Seeded sample JSON that honors your schema's types, enums and bounds.

Runs in your browser
Try an example

JSON Schema

Generated samples

No samples yet

Paste a JSON Schema or load an example.

Examples

Required fields and formats

Input
{ "type": "object", "required": ["id", "email"], "properties": { "id": { "type": "string", "format": "uuid" }, "email": { "type": "string", "format": "email" } } }
Output
[{"id":"…uuid…","email":"ada.lovelace@example.com"}]

Required fields are always present and format-aware generators produce plausible values.

Branch coverage

Input
{ "oneOf": [{ "type": "string", "const": "card" }, { "type": "integer", "const": 2 }] }
Output
["card", 2]

Two samples with the same seed exercise two different oneOf branches.

Bounded array

Input
{ "type": "array", "items": { "type": "string" }, "minItems": 3, "maxItems": 3, "uniqueItems": true }
Output
["alpha","bravo","delta"]

Array length and uniqueness constraints are enforced during generation and rechecked afterwards.

About this tool

This generator turns a JSON Schema into concrete example payloads instead of leaving you to hand-write fixtures that drift from the contract. It walks the schema rather than producing random JSON: declared types, enums and const values come first, then formats, length and numeric bounds, array constraints, required properties and combinators.

Format support covers the everyday set — email, idn-email, uuid, date, time, date-time, uri, hostname, ipv4 and phone. String bounds pad or truncate generated words; numbers respect minimum, maximum and multipleOf while integers stay integers. Arrays honor minItems, maxItems and uniqueItems, and local $ref pointers are resolved with a depth cap so recursive schemas cannot run away.

oneOf and anyOf branches rotate with the sample index, so asking for several samples deliberately exercises different alternatives. allOf subschemas are merged before generation. Every produced sample runs through a small self-check for type, enum, const, required keys and bounds; issues surface as a warning instead of being hidden.

Generation is seeded with mulberry32: the same schema, seed and options always yield the same bytes, which is exactly what CI fixtures need. The tool runs entirely in your browser — no uploads and no network calls.

What this tool does not do

  • Supports a practical subset: pattern-based strings, contentEncoding, unevaluatedProperties and remote $ref URLs are not implemented.
  • Self-validation checks the same supported subset; it is not a replacement for a full schema validator.
  • Generated values are synthetic and should never be mistaken for realistic distributions or secure secrets.
  • Schemas larger than a few megabytes or recursion beyond the depth cap are deliberately truncated with a warning.

How to use this tool

  1. Paste a schema

    Paste a JSON Schema object or load the user or product example. Invalid JSON produces an actionable error without clearing your input.

  2. Set count and seed

    Choose how many samples to generate (1–20) and a numeric seed. Reuse the seed to reproduce identical fixtures.

  3. Tune the shape

    Toggle format values and optional properties, and choose indentation from minified to four spaces.

  4. Review and copy

    Check the self-check issue count and generation summary, then copy or download the samples as JSON.

Use cases

Seeding test fixtures

Produce deterministic payloads for unit tests and Postman collections directly from the OpenAPI-derived schema your team already maintains.

Mocking API responses

Generate several samples at once so branch-heavy oneOf/anyOf responses are all represented in your mock server data.

Documentation examples

Keep docs examples in sync with the contract by regenerating them whenever the schema changes.

Supported schema keywords and formats

KeywordBehavior
type / enum / constTyped primitives; enums cycle across samples, const is copied verbatim.
formatemail, uuid, date, time, date-time, uri, hostname, ipv4 and phone produce realistic values.
minLength / maxLengthGenerated words are padded or truncated to the requested bounds.
minimum / maximum / multipleOfNumbers and integers stay within bounds and respect multiples.
minItems / maxItems / uniqueItemsArray length is bounded; unique items are retried with a cap.
$ref / oneOf / anyOf / allOfLocal references resolve; branches rotate; allOf subschemas merge.

A practical draft-07/2019-09/2020-12 subset, not a full specification validator.

Common mistakes

Mistake:Treating generated values as production data.

Fix:Samples are synthetic and shaped for plausibility, not realism or statistical accuracy. Do not use them for benchmarking, PII testing or load tests that need real distributions.

Mistake:Expecting pattern or constrained string generation.

Fix:Regular-expression patterns are not synthesized; strings use generated words adjusted to minLength and maxLength. Add a const or enum when exact values matter.

Mistake:Changing the seed and expecting the same fixture.

Fix:The PRNG seed is part of the output contract. Record it next to the fixture in CI if you want byte-identical regeneration.

Frequently asked questions

Which JSON Schema drafts are supported?

A practical subset shared by draft-07, 2019-09 and 2020-12: types, enum, const, formats, string and numeric bounds, arrays, objects, required, additionalProperties, local $ref and oneOf/anyOf/allOf. Draft-specific vocabularies such as unevaluatedProperties and remote reference resolution are outside the scope of this browser tool.

Are the samples guaranteed valid?

Every sample is checked against the same supported subset before display, and issues appear as a warning if anything looks wrong. That is a strong quality gate for the keywords listed above, but it is not a full specification validator — run your project's validator for contract-level sign-off.

How does seeding work?

A small mulberry32 PRNG is initialized with the numeric seed you enter. The same schema, seed, count and options always produce identical output on any machine, so you can commit the seed next to a fixture and regenerate it in CI without drift.

Can it handle oneOf and anyOf?

Yes. The generator rotates through the alternatives using the sample index, so generating three samples from a two-branch oneOf exercises both branches. Local $ref pointers are resolved too, with a depth cap that stops recursive schemas from looping forever.

What about pattern properties and regular expressions?

patternProperties are sampled with a small number of generated keys, but regular-expression patterns for strings are not synthesized. Strings are built from a word list and adjusted to satisfy minLength and maxLength; use const or enum when you need an exact value.

Is my schema uploaded?

No. Parsing, generation and self-validation all run in this browser tab. There is no server request and nothing is stored after you leave the page.

References & standards