FormatterHQ

JSON Schema Faker: Sample JSON from a Schema

Paste a JSON Schema and get fake JSON data that satisfies it: valid emails, dates in range, enum values and required fields filled in. Generate up to 100 records at once.

Input JSON
Output JSON
Ready.

How to use the JSON Schema to Sample JSON

  1. Paste your JSON Schema into the input editor, or load the sample User schema.
  2. Set Number of samples (1 to 100). More than one returns a JSON array.
  3. Keep Always fill optional properties on for complete objects, or turn it off to get a random mix.
  4. Enter a number in Seed if you need the same output every time, then click Generate sample data and copy the result.

Generate mock data with a JSON Schema faker

This JSON Schema faker reads a schema and produces JSON documents that conform to it. Instead of hand-writing fixtures, you describe the shape once and let the generator fill in integers within minimum/maximum, strings that match format and pattern, values from enum, and arrays that respect minItems and uniqueItems.

It is built on the json-schema-faker library, which understands the common draft-07 through 2020-12 keywords. The output is plain JSON you can paste into a test, a Postman collection, a Storybook story or a seed script.

What is a JSON Schema faker for?

A schema tells you what is allowed; a faker shows you what that looks like. That makes it useful in a few specific situations:

  • Front-end work before the API exists. Generate a list of users or orders and build the UI against realistic data.
  • Contract tests. Feed generated payloads to your endpoint to check that everything the schema allows is really accepted.
  • Reviewing a schema. If a sample looks wrong, such as a negative age or an empty array, your schema is missing a constraint.

Example

Input schema:

{
  "type": "object",
  "required": ["id", "email"],
  "properties": {
    "id": { "type": "integer", "minimum": 1, "maximum": 999 },
    "email": { "type": "string", "format": "email" },
    "plan": { "enum": ["free", "pro"] },
    "active": { "type": "boolean" }
  }
}

Output with seed 42 and optional properties filled:

{
  "id": 601,
  "email": "dave852@demo.net",
  "plan": "free",
  "active": false
}

Run it again with the same seed and you get exactly the same document, which keeps snapshot tests stable.

Options explained

  • Number of samples: 1 returns a single object; 2 to 100 return an array of independent samples generated from the same seed sequence.
  • Always fill optional properties: when on, every property in properties is generated, not only those in required. Turn it off to test how your code handles missing optional fields.
  • Seed: leave it empty for a fresh random seed on every run. The status line shows the seed that was used, so you can copy it into the field to reproduce a sample you liked.
  • Indent: 2 spaces, 4 spaces or tabs for the output.

If a property has a default, that value is used instead of a random one, which is handy for fields like "currency": "USD" that should not vary.

Edge cases and tips

  • Strings without a format come out as short random text, and can even be empty. Add minLength, format, pattern or an enum when you need realistic values.
  • Remote $ref URLs are not fetched and stop generation with an "Unresolved $ref" error. Keep definitions inside the schema under $defs or definitions.
  • Contradictory schemas, such as "minimum": 10 with "maximum": 1, cannot be satisfied. The faker still returns numbers, but they break the schema, so check suspicious output with the JSON Schema validator.

Related tools

No schema yet? Infer one from an example document with JSON to JSON Schema. Need types rather than data? Turn the same schema into interfaces with JSON Schema to TypeScript.

Privacy

Generation happens locally in your browser. Your schema is never sent to a server, so internal data models stay private.

Frequently asked questions

Is the generated data guaranteed to be valid against my schema?
For consistent schemas, yes: the faker builds values from the constraints themselves. Very complex combinations of allOf, oneOf and not can occasionally produce edge cases, so run important samples through a JSON Schema validator.
How do I get the same fake data every time?
Type a number into the Seed field. The same schema and seed always produce the same output. When the field is empty, a random seed is chosen and shown in the status message so you can reuse it.
Can I generate a list of records?
Yes. Set Number of samples to any value up to 100 and the output becomes a JSON array of that many objects. For larger fixtures, generate several batches with different seeds.
Why are my optional properties missing?
Optional properties are only generated when Always fill optional properties is on. With it off, the faker decides randomly for each non-required property, which is useful for testing how code handles partial objects.
Does it support formats like email, date-time and uuid?
Yes. Standard formats such as email, date, date-time, uri, uuid, ipv4 and hostname produce values in the correct shape. Custom formats that the library does not know fall back to generic strings.

Last updated September 26, 2026

Related tools

JSON Schema to TypeScript Turn JSON Schema into TypeScript interfaces and types with optional properties, enums, $ref definitions and JSDoc comments. JSON Schema Validator Validate JSON against a JSON Schema (draft-07, 2019-09, 2020-12) with Ajv and get every error with its path and rule. JSON to Mongoose Schema Generate a Mongoose schema and model from a sample JSON document, detecting Date, ObjectId, arrays and nested objects. JSON Serialize Online Serialize JSON into its most compact transport form, optionally wrapped as an escaped string literal for storage or messaging. JSON Sorter Sort JSON keys alphabetically at every level, ascending or descending. Optionally sort arrays of values for clean, comparable output. JSON Stringify Online Stringify JSON into an escaped string literal, exactly like JSON.stringify. Ready to embed JSON inside JSON, code or config values. JSON Syntax Highlighter Syntax highlight JSON with light, dark or Monokai themes and copy the colourised HTML for blogs, docs and slides. JSON to JSONL Converter Convert a JSON array to JSON Lines (JSONL / NDJSON), one record per line, for streaming, logging, BigQuery and ML datasets. JSON to One Line Convert multi-line JSON to a single line. Collapse formatted JSON for logs, CLI arguments, environment variables and CSV cells. JSON to PHP Array Converter Convert JSON to a PHP array literal with short [] or array() syntax, ready to paste into Laravel config files, seeders and tests. JSON to String Converter Convert JSON to a single escaped string you can paste into code, databases or other JSON documents. Choose double, single or no quotes. JSON Tree Viewer Display JSON as an expandable tree. Collapse and expand objects and arrays to understand deeply nested data structures.