JSON Schema to Sample JSON
Turn a JSON Schema into valid example data — one integer seed makes it reproducible, entirely on this device.
Every instance below was validated against your schema, here, on this device. That is the only claim made: a fixture satisfies the rules a schema can state, so names, addresses and business meaning stay outside it.
Drafts 06, 07, 2019-09 and 2020-12. draft-04 and draft-03 are refused by name. A regex `pattern` is approximated from its literal part, never solved, and oneOf/anyOf take their first branch.
The same schema, seed and options always produce the same bytes. The seed travels in the share link.
1 to 10 per run. Above 1 the artifact is a JSON array.
Omit keeps only what `required` lists; Include emits every declared property; Seeded decides each one from the same stream, so it stays reproducible.
Runs every instance back through your schema before it is shown. Turning it off also skips the schema's own meta-check, and the validator is never downloaded.
Instances appear here as you edit the schema.
Press ? for shortcuts
Do it offline:$ npx json-schema-faker schema.json
How to use it
- Paste the schema into the left pane, or drop a .json file on it — the file is read in the tab and never uploaded.
- Set the seed, ask for 1 to 10 instances, and choose whether optional properties appear; the defaults give one instance with every property present.
- Read the chips under the result: each names a keyword approximated or left out, with the pointer that locates it.
- Copy the instances, download them as a timestamped .json file, or share a permalink that reopens the same schema, seed and options.
Paste a JSON Schema and get instances you can drop straight into a fixture file or a request body. What comes back is a structurally valid fixture, not realistic data — a schema constrains shape, never meaning. The one claim made here is the one that is checked: every instance shown was validated against your schema, here, in your browser, and a mismatch is printed rather than quietly repaired. One integer seed replays the run.
Examples
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"required": ["id", "email", "status"],
"properties": {
"id": { "type": "integer", "minimum": 1 },
"email": { "type": "string", "format": "email" },
"status": { "enum": ["open", "paid", "shipped"] },
"total": { "type": "number", "minimum": 0, "multipleOf": 0.5 }
},
"additionalProperties": false
}{
"id": 12,
"email": "sample@example.com",
"status": "shipped",
"total": 0
}Four keywords, four jobs: minimum bounds the integer, the format table supplies a reserved example.com address, the enum comes from the seeded stream, and multipleOf holds the total on a half. Seed 7, defaults otherwise.
{
"type": "object",
"required": ["id"],
"properties": {
"id": { "type": "integer", "minimum": 1 },
"nickname": { "type": "string" },
"tags": { "type": "array", "items": { "type": "string" }, "minItems": 1 }
}
}[
{
"id": 512
},
{
"id": 530
}
]Seed 11, count 2, optionals omit: only the properties listed in required survive, which is the shape a strict consumer has to cope with. Ask for more than one and the artifact becomes an array.
{
"type": "object",
"properties": {
"sku": { "type": "string", "pattern": "^SKU-[0-9]{4}$" },
"ref": { "oneOf": [{ "type": "string", "format": "uuid" }, { "type": "integer" }] }
},
"required": ["sku", "ref"]
}{
"sku": "SKU-",
"ref": "3f2504e0-4f89-41d3-9a0c-0305e82c3301"
}The edge case worth meeting early. The regular expression is not run backwards, so sku keeps only its literal prefix and the self-check reports the mismatch; ref has two declared alternatives and the first was taken. Both facts arrive as chips. Seed 3, defaults otherwise.
{
"$ref": "#/$defs/node",
"$defs": {
"node": {
"type": "object",
"required": ["name"],
"properties": {
"name": { "type": "string" },
"child": { "$ref": "#/$defs/node" }
}
}
}
}{
"name": "lima",
"child": {}
}A node containing itself has no finite instance. The cycle is cut at the first repeat and an empty object written there, which the self-check flags because name is required inside it. Seed 2, defaults otherwise.
Every example on this page is executed against the same engine that powers the tool, on every build.
Gotchas worth knowing
The drafts that actually run
Generation and the meta-check both cover draft-06, draft-07, 2019-09 and 2020-12. A $schema naming draft-04 or draft-03 is refused by name rather than guessed at: those drafts spell exclusiveMinimum as a boolean flag, so reading them under newer rules would change what the numbers mean.
pattern is approximated, never solved
Turning a regular expression into a string that matches it is a search problem, and this page does not attempt one. A fully literal anchored pattern is used as written; anything else contributes its prefix and earns a chip, after which the self-check says the value does not match.
oneOf and anyOf take the first branch
Alternatives are declared, not ranked, so choosing between them would be invention rather than reading. The first branch is generated and a chip records how many were available. Put the branch you want fixtures for first.
Contradictions are pinned, not repaired
A minLength above its maxLength, or a minimum above its maximum, describes a value that cannot exist. The lower bound wins, a chip names the contradiction with its pointer, and the self-check reports the failure. The schema is left for you to fix.
Common errors
Unexpected '}' at line 1, column 21 — probable cause: trailing comma after the last property.- The schema has to parse as JSON before anything else. The caret frame marks the character and Jump to error puts the cursor there; the pane is never rewritten.
`"$schema": "http://json-schema.org/draft-04/schema#"` names a dialect this tool cannot generate from. It supports draft-06, draft-07, 2019-09, 2020-12 — draft-04 and draft-03 are not supported, so remove or update the `$schema` line to generate.- Deleting the line is usually right: most draft-04 documents are already valid under draft-07. Check any exclusiveMinimum or exclusiveMaximum first — they carried a boolean in draft-04 and a number afterwards.
Reference "https://example.com/other.json#/x" at # points outside this schema document. Nothing is downloaded here: only references inside the same document are resolved — "#", "#/…" pointers and "#name" anchors.- A split schema has to be stitched together before it arrives: inline the subschema under $defs and point the reference at it, or bundle the files first.
The generated instance does not satisfy the schema at `/sku`: must match pattern "^SKU-[0-9]{4}$"- A warning, not a refusal — the instances are still returned. This is the self-check earning its place: ajv's own pointer and wording arrive untouched, so an approximated value is visible rather than presented as correct.
The schema is larger than the 1 MB limit for this tool, so nothing was generated — a JSON Schema describes a shape, so the document that defines it is normally far smaller than this. Trim it to the part you want instances of, or split it.- Past the cap the run is refused whole, never trimmed. A document this size is usually a bundle: point the tool at the definition you need instances of.
FAQ
Can I get realistic names and addresses out of this?
No, and the limit is the schema's rather than the tool's: it can say a field is a string of at most forty characters, but not that the string is a surname. Values here are deliberately unmistakable placeholders, drawn from a fixed word list and the reserved documentation ranges.
Why did the self-check fail on something this page generated?
Because a keyword was reported rather than honoured. Approximated patterns, if/then/else, not, dependentSchemas and patternProperties all constrain an instance without describing one, so the value ignores them and the check says so. Each is listed in a chip with its pointer. The check is optional: turn it off and the page stops claiming these instances were checked.
Will the same seed give me the same JSON tomorrow?
Yes. The generator reads one seeded stream in a fixed order and consults no clock: even the date-time value is a pinned instant rather than the current time. Same schema, same seed, same options gives identical bytes — which is what makes these safe to commit as fixtures.
Keyboard shortcuts
- ⌘/Ctrl + Enter
- Run the schema again with the options as they stand.
- ⌘/Ctrl + S
- Save the instances as a .json file instead of the page.
- ⌘/Ctrl + C
- With nothing selected, copies the whole artifact.
- ⌘/Ctrl + Shift + C
- Copy the whole artifact even while a selection is live.
- t
- Flip the theme, unless a text field currently has focus.
- ? or ⌘/Ctrl + /
- Bring up the list of shortcuts.
- Esc
- Dismiss the topmost overlay.