Generate realistic fake JSON data from a JSON Schema for API testing, UI prototyping, load testing, and contract-driven development.
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.
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.
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.
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.
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"
}