JSON Schema test data generator
Paste a JSON Schema and get the test data that exercises it: a valid instance, the boundary values that must pass, and an invalid variant for every rule that should fail. Copy them or download them as JSON or JSON Lines, and feed them to your API tests.
Runs in your browser: nothing is uploadedWhat it generates
From one valid instance it derives: each required property removed, null and a wrong type in
every field, strings one character past maxLength and one short of minLength, numbers
just outside minimum and maximum and exactly on them, fractions where an integer is
expected, values outside an enum (including the right word in the wrong case), a value that breaks the
pattern, broken emails, dates and UUIDs, arrays one item too short or too long, duplicates where
uniqueItems is set, and an unexpected property where additionalProperties is false.
Every case is checked
A generator that mislabels its cases is worse than none, because a test then passes for the wrong reason. So each case is run through a validator for the same keywords before it is shown, and a variant whose outcome another rule changes, such as a boundary string the pattern rejects, is dropped rather than mislabelled. Free-text fields also get values whose validity the schema decides: an empty string, only spaces, Unicode and emoji, HTML and an apostrophe, and 10,000 characters where there is no limit.
What it does not cover
Conditional keywords (if, then, else),
patternProperties, dependentRequired and references to other files are not evaluated.
When a schema uses them the page lists them, so you know which rules still need a test of their own. Format
cases fail only if your validator enforces format: most treat it as an annotation by default.
Questions
Which JSON Schema drafts does it support?
The keywords shared by draft-07, 2019-09 and 2020-12 that describe data: types, properties, required, enum, const, string and number limits, pattern, format, arrays, $ref within the schema, allOf, anyOf, oneOf and not. The boolean form of exclusiveMinimum from draft-04 also works.
Why do my format cases pass validation?
Because format is an annotation unless the validator is told to assert it. In Ajv add ajv-formats; in Python jsonschema pass a format_checker. The page marks those cases "only when format is enforced".
Can it generate a value for any regex pattern?
For literals, character classes, quantifiers, groups and alternation, yes. For lookaheads and other advanced constructs it asks you to add an "examples" entry to the property, and uses that example as the valid value.
Is my schema uploaded?
No. Generation and checking run in this page. Nothing is sent to a server, which matters when the schema describes an internal API.