API Mock Data Generator
Design nested JSON API schemas with 40+ semantic field types, simulate REST latency and HTTP error codes, and export payloads alongside TypeScript, Zod, GraphQL, and JSON Schema contracts.
Preset: User APIReady locally via WebAssembly & JavaScript
[
{
"id": 1,
"fullName": "Sarah Smith",
"username": "sarah.smith45",
"email": "sarah.smith45@gmail.com",
"phone": "(415) 555-2671",
"avatarUrl": "https://i.pravatar.cc/150?img=12",
"jobTitle": "Frontend Developer",
"address": {
"street": "142 Maple Rd",
"city": "Seattle",
"state": "WA",
"country": "United States",
"zipCode": "98101",
"coordinates": {
"lat": 47.6062,
"lng": -122.3321
}
},
"role": "admin",
"isActive": true
}
]100% Client-Side • Zero Server UploadModern web and mobile teams rarely build frontend and backend layers strictly sequentially. Waiting for database migrations, service controllers, and staging deployments before wiring UI components stalls entire sprints. By defining a shared data contract up front and generating structurally authentic mock payloads locally in the browser, frontend engineers, backend architects, and QA teams can develop and validate against the same shape in parallel—without exposing proprietary internal schemas to external cloud mocking services.
Recursive Schema Architecture and Field Constraint Rules
Unlike flat tabular generators, real REST and GraphQL payloads contain multi-level hierarchies: an e-commerce order embeds a shipping address object, which in turn embeds geographic coordinates, alongside a variable-length array of line items. The generator models every payload as a recursive tree of SchemaField nodes. When the resolver encounters an object node, it traverses child fields recursively; when it encounters an array node, it samples a length between rules.min and rules.max (defaulting to 1–5 items) and synthesizes a typed element object per iteration.
Fine-grained constraints turn generic dummy JSON into adversarial test data capable of exposing subtle client bugs:
- Stochastic Nullability: Setting
nullable: truealongsidenullProbability(0–100%) injectsnullvalues on a controlled percentage of rows, immediately revealing unhandledCannot read properties of nullcrashes in UI renderers. - Scoped Uniqueness & Sequential Keys: Integer or number fields named
idat the root level auto-increment cleanly fromstartId, while any field flaggeduniquetracks emitted values in a path-scopedSet(for example,comments[].idoremail) so identifiers remain collision-free across the batch. - Format-Authentic Primitives: Semantic resolvers generate RFC 4122 Version 4 UUIDs (setting the
4version nibble and10xxvariant bits), ISO 8601 dates (YYYY-MM-DD), Unix epoch seconds, IPv4 dotted quads, decimal coordinates (-90to90latitude and-180to180longitude at 6-digit precision), realistic browserUser-Agentstrings, and HS256-structured mock JWTs. You can inspect generated token structures directly inside our JWT Decoder to confirm claim formatting.
Compiling One Visual Model into Four Type Systems
Maintaining mock fixtures separately from TypeScript types, runtime validators, and API documentation almost always results in schema drift. The generator eliminates manual translation by compiling the exact same schema AST into four industry-standard contract formats:
| Schema Feature | TypeScript Interface | Zod Validator | JSON Schema (Draft-07) | GraphQL SDL |
|---|---|---|---|---|
| Integer / Timestamp | number | z.number() | "type": "number" | Int |
| Float / Decimal / Price | number | z.number() | "type": "number" | Float |
| Email / UUID / URL | string | z.string().email() / .uuid() / .url() | "type": "string" | String |
| Nullable Field | T | null | .nullable() | "type": ["<type>", "null"] | Nullable field (omits ! if optional) |
Optional Field (required: false) | field?: T | .optional() | Excluded from required[] array | Omits non-null ! modifier |
| Nested Object / Array | Inline { ... } or { ... }[] | z.object({ ... }) / z.array(...) | Nested properties / items | Hoisted Parent_Child named object type |
Notice how GraphQL SDL automatically hoists nested anonymous objects into distinct named types (such as ResponseItem_Address and ResponseItem_Address_Coordinates) because GraphQL does not permit inline anonymous object definitions inside type fields.
Simulating Real-World HTTP Status Codes and Network Jitter
Testing exclusively against instant 200 OK JSON files hides race conditions, double-submit bugs, and broken empty states. API Simulation Mode mirrors real network behavior defined in RFC 9110:
- Latency Injection (0–5,000 ms): Dialing response delay to 1,500–3,000 ms exposes missing loading indicators, layout shifts when skeleton placeholders swap to real text, and stale-response bugs when users trigger rapid filter changes without
AbortControllercancellation. - Error Status Verification: Toggling
400 Bad Request,401 Unauthorized,403 Forbidden,404 Not Found, and500 Internal Server Errorconfirms that authentication interceptors trigger token refresh flows on401, permission banners render cleanly on403, and unexpected500responses land in graceful fallback UI rather than unhandled promise rejections. - Pagination Envelopes: Enabling pagination wraps the generated slice inside standard
page,limit, andtotalRecordsmetadata so you can test boundary conditions—including last-page partial arrays and zero-item responses—before backend cursor or offset logic exists.
Runtime Validation Workflow: Pairing Mock Payloads with Zod
Because TypeScript interfaces vanish at compile time, pairing a generated Zod schema with mock JSON responses catches upstream API breaking changes during integration tests:
import { z } from "zod";
// Copied directly from the Type Definitions -> Zod tab
export const userApiSchema = z.object({
id: z.number(),
email: z.string().email(),
role: z.string(),
address: z.object({
city: z.string(),
zipCode: z.string().nullable(),
}),
});
export type UserApiItem = z.infer<typeof userApiSchema>;
export async function fetchUsers(endpoint: string): Promise<UserApiItem[]> {
const res = await fetch(endpoint);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const payload: unknown = await res.json();
return z.array(userApiSchema).parse(payload);
}
When inspecting minified API payloads or comparing serialized responses before plugging them into tests, you can pretty-print and validate syntax with our JSON Formatter.
Flattening Nested Payloads for CSV and SQL Seeding
Exporting hierarchical schemas into relational tables or spreadsheets requires predictable serialization rules:
- Dot-Path CSV Flattening: Nested
objectproperties expand into dot-delimited columns (for example,address.city,address.coordinates.lat), while nestedarrayfields serialize as JSON strings wrapped in RFC 4180 double quotes (""escaping internal quotes). - Typed SQL Statements: The SQL serializer emits backtick-quoted table and column identifiers (
INSERT INTO \mock_table` (...) VALUES (...);), maps booleans to nativeTRUE/FALSE, preserves numeric scalars unquoted, and converts nested objects or arrays into single-quote-escaped JSON literals ready forJSONorJSONB` columns. If you are preparing PostgreSQL scripts that require double-quoted identifiers instead of MySQL backticks, or need formatted multi-line readability before running migrations, run the output through our SQL Formatter. - Client-Side Batch Ceiling: Generating up to 5,000 records runs instantaneously in the browser's main thread without backend quotas; for multi-million-row stress benchmarks, export the schema's JSON Schema or Zod definition and drive bulk seeding inside a local Node.js or Python script.
How to Use API Mock Data Generator
Load an existing preset (User, Product, Blog, Ecommerce, Social Media, or Auth) or click Add Root Field to model a custom payload.
Assign semantic field types across Basic, Identity, Internet, Location, Business, Developer, Lorem, Object, or Array categories.
Open each field's validation rules to configure numeric ranges, decimal precision, date bounds, enum options, uniqueness, or null probability.
Set your desired record count (up to 5,000 rows) and inspect live data in JSON, Minified JSON, CSV, SQL, or JS Object format.
Switch to Type Definitions to copy compiled TypeScript interfaces, Zod schemas, GraphQL types, or JSON Schema Draft-07.
Open API Simulation Mode to configure response latency, HTTP status codes, and pagination envelopes for client-side integration tests.
Real Examples
User Profile JSON Schema
Generates a structured user account with contact info, avatar URL, and job title.
Preset: User API[
{
"id": 1,
"fullName": "Sarah Smith",
"username": "sarah.smith45",
"email": "sarah.smith45@gmail.com",
"phone": "(415) 555-2671",
"avatarUrl": "https://i.pravatar.cc/150?img=12",
"jobTitle": "Frontend Developer",
"address": {
"street": "142 Maple Rd",
"city": "Seattle",
"state": "WA",
"country": "United States",
"zipCode": "98101",
"coordinates": {
"lat": 47.6062,
"lng": -122.3321
}
},
"role": "admin",
"isActive": true
}
]Product Table SQL Insertion
Mock SQL inserts for seeding relational database product inventories.
Schema: Product API (id, name, price, brand) -> Format: SQLINSERT INTO `mock_users` (`id`, `name`, `price`, `brand`) VALUES (1, 'Smart Monitor', 349.99, 'TechCorp');
INSERT INTO `mock_users` (`id`, `name`, `price`, `brand`) VALUES (2, 'Wireless Headphones', 129.50, 'ApexDigital');
INSERT INTO `mock_users` (`id`, `name`, `price`, `brand`) VALUES (3, 'Ergonomic Chair', 249.00, 'NexusTech');TypeScript API Typings
TypeScript interfaces auto-inferred from custom schema hierarchies.
Type Generator: TypeScriptexport interface MockResponse {
id: number;
fullName: string;
email: string;
address: {
street: string;
city: string;
zipCode: string;
};
isActive: boolean;
}Frequently Asked Questions
How does the generator enforce unique values across nested objects and arrays?
Are the generated JWTs and API keys cryptographically valid credentials?
How are nested objects handled when exporting to flat formats like CSV or SQL?
What HTTP conditions can I test in API Simulation Mode?
Do custom schemas or generated payloads leave my browser?
Key Features
- Recursive visual schema builder supporting deeply nested objects, variable-length arrays, and 40+ semantic data types
- Field-level constraint engine covering min/max bounds, decimal precision, custom enum arrays, uniqueness sets, and probabilistic null injection
- Four-target contract compiler generating TypeScript interfaces, Zod validators, JSON Schema Draft-07, and GraphQL SDL from one schema
- Interactive REST API simulator with 0–5,000 ms network latency, HTTP status overrides (200–500), and pagination envelopes
- Multi-format data exporter producing pretty or minified JSON, dot-flattened CSV, SQL INSERT statements, and native JavaScript arrays
- Pre-built starter presets for User, Product, Blog, Ecommerce, Social Media, and Authentication APIs plus localStorage schema persistence
Common Use Cases
- Unblocking React, Vue, and mobile teams with realistic JSON contracts before backend microservices are deployed
- Generating Zod runtime validators and TypeScript interfaces simultaneously during OpenAPI and API-first design reviews
- Verifying UI skeleton screens, retry logic, and error boundaries under slow responses and 401/404/500 HTTP failures
- Seeding PostgreSQL or MySQL staging tables with thousands of typed rows including JSON/JSONB columns
- Creating deterministic edge-case test payloads with nullable fields, empty arrays, and boundary prices for QA suites
- Embedding realistic sample payloads and GraphQL types inside technical API documentation and Postman collections
Related Tools
Explore More Tools in This Category
View All Developer & Utility ToolsHTML Table Generator
Visually design, style, and export accessible, responsive HTML tables right in your browser. Import CSV, TSV, or JSON data, merge cells, test desktop-to-mobile viewports, and compile clean HTML, Tailwind CSS, React JSX, Bootstrap, or Markdown.
Username Generator
Create platform-validated, memorable handles for gaming, social media, software engineering, and brand accounts with leetspeak mutations, heuristic scoring, and TXT, CSV, or JSON bulk exports.
Random String Generator
Generate cryptographically secure API keys, session tokens, JWT signing secrets, compact database IDs, and pattern-masked coupon codes in bulk up to 5,000 deduplicated strings offline.
AI Prompt Helper & Optimizer
Analyze token counts, score prompt clarity across five engineering axes, and transform rough ideas into structured prompts tailored for GPT, Claude, Gemini, DeepSeek, and image models.
Instagram & TikTok Hashtag Generator
Generate and rebalance trending, popular, medium, and niche hashtags for Instagram Reels, Posts, and TikTok videos alongside structured captions and reusable tag groups.
Bio Link Page Generator
Build mobile-first link-in-bio pages with customizable themes, drag-and-drop links, 17 social icons, media embeds, QR codes, and single-file static HTML export.
Text to Speech & AI Voice Generator
Transform written scripts and documents into ultra-realistic human speech with customizable pitch, speed, and neural voice personas. 100% free with instant MP3 download.
UUID Generator
Generate cryptographically secure RFC 9562 UUIDs (v1, v4, v6, and time-ordered v7) individually or in batches up to 10,000, with instant validation, custom formatting, and language snippets.