Generate a sample JSON document from a JSON Schema — honoring const, default, enum, formats, required properties and local $refs. Useful for mocking API payloads and writing docs.
Show calculation steps
Processed privately in your browser — nothing you paste is uploaded, logged or stored.
From contract to concrete example
A schema tells machines what data may look like; humans and tests want an actual document. This generator walks your schema and produces one valid-shaped instance: const, default, examples and enum values are used verbatim when present, string formats get realistic placeholders (a real-looking email, an ISO date-time, a UUID), numbers respect minimum and multipleOf, and local $refs into $defs are resolved — with a depth cap so recursive schemas cannot hang the page.
Worked example
Schema:
{
"type": "object",
"required": ["id", "email"],
"properties": {
"id": { "type": "integer", "minimum": 1 },
"email": { "type": "string", "format": "email" },
"plan": { "type": "string", "enum": ["free", "pro", "team"] },
"tags": { "type": "array", "items": { "type": "string" }, "minItems": 2 }
}
}Generated example:
{
"id": 1,
"email": "[email protected]",
"plan": "free",
"tags": ["string", "string"]
}When to use it
- Mocking API responses in tests and prototypes before the real service exists.
- Adding a realistic example block to API documentation straight from the contract.
- Sanity-checking a schema you just wrote — if the generated sample looks wrong, the schema is wrong.
- Round-tripping with the JSON to JSON Schema converter to verify inference.
Limitations to know
- External
$refs (URLs) are not fetched — this tool makes no network requests by design. Inline them locally first. patternregular expressions are not satisfied automatically; you get a plain string plus a warning naming the skipped pattern.anyOf/oneOfuse their first variant; the sample shows one valid shape, not every possible one.- Values are deterministic placeholders, not random fake data — the same schema always yields the same example, which keeps tests stable.
Common errors and fixes
- “The input must be a JSON Schema object” — you pasted a data document or an array; this tool consumes the schema itself.
- A property came out null — its subschema has no
typeand nothing else to infer from; add a type (the warning lists the spot). - “Recursion depth limit reached” — a circular $ref chain was cut off at 32 levels with a null placeholder; expected behavior for self-referencing schemas like linked lists.
How to use the JSON Schema Example Generator
- Paste a JSON Schema into the input panel.
- Choose whether optional properties are included and how many items arrays get.
- Click "Generate example".
- Copy the sample document for your mocks, tests or documentation.
Frequently asked questions
Which schema keywords are honored?
const, default, examples and enum (in that priority), type including union arrays, properties and required, items, prefixItems and minItems, minimum/exclusiveMinimum/maximum/multipleOf, common string formats (email, date-time, uri, uuid and more), allOf via merge, anyOf/oneOf via their first variant, and local $ref into $defs or definitions.
Does it resolve external $refs?
No — this tool runs entirely in your browser and never makes network requests, so a $ref pointing at another URL is left as null with a warning. Inline the referenced schema locally if you need it in the sample.
What about circular references?
Recursive schemas are handled with a depth cap: after 32 levels the generator inserts null and warns, instead of hanging your browser tab.
Why is my pattern property just "string"?
Generating text that satisfies an arbitrary regular expression is not supported; the tool emits a plain placeholder string and tells you which pattern it skipped so you can fill that value in manually.