API Response Mocker — Free Online Fake JSON Generator
Generate realistic fake JSON data for API mocking, testing, and development. Define your schema with field types and get instantly generated mock data that looks real. 100% client-side — no data leaves your browser.
What is API mocking? API mocking replaces a real HTTP endpoint with a stand-in that returns data of the same shape, so a front end can be built and tested before the back end exists. This generator produces that stand-in payload: you declare field names and types, and it emits a matching JSON array or object filled with plausible names, emails, ISO dates, UUIDs and numbers instead of placeholder strings.
How to Use the API Response Mocker
- Add fields by clicking "+ Add Field" and selecting the data type for each.
- Import a schema — paste any JSON object and it will auto-detect field names and types.
- Set locale to generate locale-appropriate names, addresses, and phone numbers.
- Set the count of records you need (1-1000).
- Choose wrapper — array, object with metadata, or raw records.
- Click "Generate" then copy, download JSON, or export as CSV.
How the Mock Data Generator Works
The generator is a schema interpreter, not a template engine. Your field list is read into an array of
{ name, type, options } descriptors, and for every record the tool walks that array once and calls a
value factory for each field. The record loop runs N times, where N is the record count you set,
so the cost is linear in fields multiplied by records and a thousand records stay instant in the browser.
Each type has its own factory. String types draw from curated word pools rather than random characters, which is why
output reads like real data: a name field concatenates one entry from the locale's given-name pool with one
from its surname pool, and an email field builds first.last@domain from the same pools so the
address is consistent with a human name. Structural types recurse — an object field owns its own child field
list and is generated by re-entering the same factory one level down, so nesting depth is unlimited.
Field Types and What They Produce
Twenty-nine field types are available. The table below covers the ones whose output format matters most when you are matching an existing API contract.
| Type | Output shape | Notes |
|---|---|---|
| id | 1, 2, 3 | JSON number, auto-incremented per record — never random, so it is safe as a key |
| uuid | 3f2b…-4a1c-8e07-… | RFC 4122 version-4 layout: 8-4-4-4-12 hex, version nibble fixed to 4, variant nibble to 8–b |
| date | 2024-07-19 | ISO 8601 calendar date, drawn from 2020-01-01 through 2026-12-31 |
| datetime | 2024-07-19T11:04:22.517Z | Full ISO 8601 instant in UTC, same date window |
| number / float | 4213 / 62.48 | Integer or two-decimal float inside the min/max you supply (defaults 1–10000 and 0–100) |
| phone / zip | +44 7712 480933 | Format follows the selected locale, not a single hard-coded pattern |
| color | #7ac3e1 | Six-digit lowercase hex, always zero-padded |
| array | [12, 88, 4] | Three to six items of the item type you choose |
| object | { "city": "Lyon" } | Nested record built from the child fields you add to that row |
| regex | your pattern | Reverse-generates a string from a pattern subset: \d, \w, ranges such as [a-z], and alternation (gold|silver) |
Locales, Wrappers and Export
Seven locales ship with the tool — United States, United Kingdom, France, Germany, Spain, Japan and Brazil. Switching locale swaps the whole pool set at once: given names, surnames, city list, street naming convention, postal-code shape and international dialling prefix all change together, so a German record does not end up with a French postcode. Use it when you need to prove that a UI survives long surnames, non-Latin city names or postal codes that contain letters.
The wrapper control decides what the response envelope looks like. Array emits a bare
[ … ], which is what most list endpoints return. Object wraps the records under a
data key alongside a meta block, matching the paginated envelope used by JSON:API-style
back ends. None emits records one per line, which is the form newline-delimited JSON log fixtures need.
CSV export flattens nested objects with dot notation, so address.city becomes a column header and the file
opens cleanly in a spreadsheet.
Randomness comes from Math.random(), which is fast but not cryptographically secure and not seeded, so
two clicks of Generate never produce the same payload. That is the right trade-off for fixtures and demos, and the
wrong one for anything security-sensitive — do not use generated values as tokens, secrets or salts. Credit-card
values are format-shaped only: sixteen digits in four groups, with no Luhn checksum applied and no relationship to
any real card.
Frequently Asked Questions
The generator uses randomized but realistic patterns: names from common name lists, emails matching the name, addresses with valid city/state combinations, and dates within reasonable ranges. Locale-specific data uses country-appropriate names, addresses, and phone formats.
Yes! Click "Import JSON" and paste any JSON object. The tool will analyze the structure and create fields with appropriate types. Nested objects are flattened and arrays are detected automatically.
Select the "object" field type, then click the "+" button on that field to add sub-fields. For example, create an "address" object with "street", "city", and "zip" sub-fields. The output will contain properly nested JSON.
Array wraps all records in [...] — typical for list endpoints. Object wraps in {"data": [...], "meta": {...}} — common for paginated APIs. None gives raw records, one per line.
Yes. Click "Download .csv" to export the generated data as a CSV file. Nested objects are flattened with dot notation (e.g., address.city), values containing commas or quotes are escaped, and the file opens directly in Excel, Numbers or Google Sheets. Array fields are serialised into a single cell, so reimporting a CSV will not restore the original nesting — keep the JSON copy if structure matters.
No. The whole generator is a single JavaScript file that runs in your tab. Schemas, imported JSON and generated records stay in page memory, nothing is posted to a server, and downloads are produced locally with a blob URL. That also means the tool works offline once the page has loaded, and nothing you paste into the schema importer is stored or logged.
For volume and shape, yes. For statistical realism, no. Values come from Math.random() and each field is drawn independently, so there are no correlations between columns — a record can hold a Japanese city with a Brazilian phone number if you mix locales, and value distributions are uniform rather than skewed the way production data is. Treat it as fixture data, not as a substitute for a sampled production dump.
The regex type is a small reverse-generator, not a full engine. It understands literal characters, \d, \w, character ranges such as [a-z], and alternation such as (gold|silver). The quantifiers *, + and ? are skipped, and a {n,m} repetition emits that many lowercase letters regardless of what precedes it. For a fixed format like an order code, spell it out: ORD-\d\d\d\d rather than ORD-\d{4}.
Use Cases
Frontend Without Backend
Develop and test frontend applications independently when the backend API is still being built or unavailable.
API Prototyping
Prototype API responses before the backend is ready, enabling parallel development and faster iteration cycles.
Error Handling Testing
Simulate various API error responses and edge cases to test how your application handles failures gracefully.
Demos and Presentations
Create realistic data for client demos, stakeholder presentations, or portfolio showcases without live API dependencies.
Isolating Frontend Bugs
Rule out backend issues by testing with mock data to determine whether a bug originates in the frontend or backend code.