JSON Mock Data Generator

JSON Schema Input

1

Generated Mock Data Output

Settings
Array Count3

Controls how many objects Faker creates inside array fields.

Optional Props80%

Chance that non-required schema properties are included.

Seed

Keep this steady for reproducible Faker output.

Locale

Faker uses locale packs for names, addresses, and phone numbers.

Batch Size

Generate multiple top-level records at once. Larger batches may take longer.

Number Distribution

Even spread between your minimum and maximum constraints.

Missing Value Probability0%

Introduce nulls or entirely missing properties to mimic incomplete data.

Dirty Value Probability0%

Replace a slice of primitive values with strings like "N/A" to stress-test validation.

Generate Mock Data

Enter a JSON schema to generate realistic mock data for testing and development

Supports common JSON Schema types

Generates realistic fake data

Customizable data count and locale

Batch mode & imperfect data simulation

How to generate mock JSON data from JSON Schema – step-by-step guide

Generate realistic fake JSON data from a JSON Schema for API testing, UI prototyping, load testing, and contract-driven development.

  1. Step 1 – Provide a JSON Schema

    • Paste a schema into the left editor, or import one from a file/URL/sample.
    • Start from your real API schema when possible to keep mock data close to production.
  2. Step 2 – Make the schema mock-friendly

    • Avoid unsupported keywords such as $ref, dependencies, and conditional schemas (if/then/else).
    • If your schema uses $ref, try opening the Mock Generator from a tool that preloads and dereferences schemas (for example “Generate Mock Data” on code→schema pages).
    • Keep the schema focused on types, properties, required, items, formats, and constraints.
  3. Step 3 – Configure generation settings

    • Pick a locale for realistic names, addresses, and phone numbers.
    • Set a seed for reproducible mock data (great for tests and snapshots).
    • Adjust batch size, array count, number distributions, and optional-field probability.
    • Use missing/dirty data simulation to test validation and UI error handling.
  4. Step 4 – Generate and review the output

    • Click “Generate Mock Data” to produce output that follows your schema constraints.
    • If values look off, tighten the schema (formats, enums, min/max) and regenerate.
  5. Step 5 – Use mock data in tests and generators

    • Copy or download the JSON and use it as fixtures for unit/integration tests.
    • Feed the generated JSON into code generators (TypeScript/Java/etc.) to create matching DTOs.

Important note about JSON Schema features

  • Schemas that rely on $ref, dependencies, or if/then/else need to be simplified or dereferenced before mock generation.
  • Schema validators differ in how they interpret drafts and keywords; use a full validator in CI for strict contract testing.
Example: JSON Schema → mock JSON
// JSON Schema (input)
{
  "type": "object",
  "properties": {
    "id": { "type": "string", "format": "uuid" },
    "email": { "type": "string", "format": "email" },
    "active": { "type": "boolean" },
    "createdAt": { "type": "string", "format": "date-time" }
  },
  "required": ["id", "email", "active", "createdAt"]
}

// Mock JSON (output example)
{
  "id": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
  "email": "maeve@example.com",
  "active": true,
  "createdAt": "2024-03-01T10:15:00.000Z"
}

Related schema & code generation tools

Generate schemas, validate contracts, and turn stable JSON examples into typed code.

Frequently Asked Questions

What is mock data generation?

Mock data generation creates realistic fake data based on JSON Schema definitions. It's useful for testing, development, and prototyping when you need sample data that matches your data structure.

How does the generator work?

The generator analyzes your JSON Schema and creates data that conforms to the defined types, constraints, and formats. It supports strings, numbers, booleans, arrays, objects, and various string formats like email, date, and UUID.

What generation options are available?

Open the settings panel to fine-tune output. Control array sizes, batch size, and locale, lock in a randomization seed, select number distributions, adjust optional-property probability, and even simulate missing or dirty data for resiliency checks.

What schema features are supported?

The generator supports basic types, object properties, arrays, string formats, enums, const values, min/max constraints, and common composition keywords like anyOf/oneOf/allOf. Schemas using $ref, dependencies, or if/then/else conditionals may need to be simplified or dereferenced before mock generation.

How can I make generation reproducible?

Use the seed option in the settings panel to generate the same data every time. This is useful for consistent testing scenarios or when you need to recreate specific data sets.

Can I control the data volume?

Yes. Use array count for per-field collections and the batch size control for the number of top-level records. Optionals probability, missing-value, and dirty-value sliders help you mimic sparse or messy datasets.

JSON Schema Mock Data Generator Online | JSONSwiss