oktools

Mock Data Generator

Generate realistic fake JSON from a JSON Schema, an OpenAPI or Swagger schema, or just an example object. Values follow the schema's types, enums, formats, patterns and bounds, and read like real data — names, emails, addresses, prices and dates that fit the property names. Every record is checked against the schema, and the same seed always gives the same data. Download it as JSON, NDJSON or CSV; nothing leaves your browser.

JSON Schema

How property names shape the values

Property namesExample value
firstName, lastName, nameAda, Lovelace, Ada Lovelace — one person per object
email, usernameada.lovelace@example.com, ada42
city, country, countryCodeLisbon, Portugal, PT — always a matching set
street, postcode, phone12 Station Road, 40521, +1-555-201-3344
price, amount, quantity, age129.99, 1-10, 18-90
createdAt, updated_at, birthDate2025-07-14T08:21:05Z, 1990-03-02
id1, 2, 3… for a record's own id; a UUID when the type is string
description, title, statusA sentence, a short title, active / pending / inactive
avatar, url, companyAn image URL, an example.com link, Granite Labs Ltd

How it works

The schema is the contract and the property names are the flavour. For each record the generator walks the schema: a const or an enum is used as written, an example is picked now and then, allOf is flattened into one schema, oneOf or anyOf chooses one option per record, and a $ref is followed inside the document, going shallow after two levels of recursion and stopping after four. The type decides the shape — object, array, string, number, boolean or null — with one entry of a type list picked at random and a nullable value left null as often as the Nulls option says.

Within what the schema allows, the name steers the value. A firstName, lastName and email in the same object belong to one fictional person, city, country and countryCode agree with each other, price gets an amount with cents, age falls between 18 and 90, and a record’s own integer id counts up from 1. When the name says nothing, the format does — date-time, email, uuid, ipv4 and the rest — then a pattern is sampled by walking its regular expression, and minimum, maximum, exclusive bounds, multipleOf, minLength, maxLength, minItems, maxItems and uniqueItems are applied last, so a named value still fits the schema.

Every random choice comes from a Mulberry32 generator seeded with the number in the Seed box, so one schema, one set of options and one seed always give the same records, and dates are spread over the year before 1 January 2026 rather than counted back from today. Afterwards each record is checked against the schema with the shared JSON Schema validator, in the schema’s own dialect, and the line under the output says whether all of them pass or quotes the first failure. The output is a JSON array, one object per line, or CSV with nested objects flattened into dotted columns.

Examples

Generate a user from the sample schema

The page’s sample schema with the default options. The name, email and address fit together, postcode matches its ^[0-9]{5}$ pattern, age stays within the schema’s 18 to 99, roles respects uniqueItems and createdAt is a date-time. Seed 1 gives exactly this record every time; New seed gives another person.

Options
Records: 1 · Seed: 1 · Optional fields: Sometimes · Nulls: Sometimes (10%)
Mock data, JSON
{
  "id": 1,
  "firstName": "Maya",
  "lastName": "Adams",
  "email": "maya.adams@mail.example.com",
  "age": 90,
  "plan": "pro",
  "roles": [
    "admin"
  ],
  "address": {
    "street": "42 Main Street",
    "city": "Austin",
    "postcode": "22657",
    "country": "United States"
  },
  "bio": "Thing turn about single her take its get her part city by go.",
  "active": false,
  "createdAt": "2025-02-19T05:43:25Z"
}

Generate pets from an OpenAPI oneOf

Pet is the first schema in the document, so it is selected on its own. Each record takes one branch of the oneOf: a cat carries indoor and a dog carries weightKg within its 2 to 60 bounds, name is a full name, and all three pass the Pet schema in the OpenAPI 3.0 dialect.

OpenAPI document
openapi: 3.0.3
info: {title: Pets, version: '1'}
paths: {}
components:
  schemas:
    Pet:
      oneOf:
        - $ref: '#/components/schemas/Cat'
        - $ref: '#/components/schemas/Dog'
    Cat:
      type: object
      required: [name, kind, indoor]
      properties:
        name: {type: string}
        kind: {enum: [cat]}
        indoor: {type: boolean}
    Dog:
      type: object
      required: [name, kind, weightKg]
      properties:
        name: {type: string}
        kind: {enum: [dog]}
        weightKg: {type: number, minimum: 2, maximum: 60}
Mock data, NDJSON, 3 records, seed 1
{"name":"Maya Adams","kind":"dog","weightKg":26.7}
{"name":"Zoe Martin","kind":"cat","indoor":true}
{"name":"Hugo Silva","kind":"dog","weightKg":19.1}

Make more records from one example

The object is turned into a schema first — integer, string, number, string and a string with the date-time format — and the names do the rest: orderId counts up, customerName is a full name, total an amount with cents and status one of the usual states. The badge over the editor reads Example data — schema inferred.

Example JSON
{ "orderId": 1, "customerName": "Ada Lovelace", "total": 84.5, "status": "paid", "placedAt": "2026-01-05T09:00:00Z" }
Mock data, JSON, 2 records, seed 1
[
  {
    "orderId": 1,
    "customerName": "Maya Adams",
    "total": 360.65,
    "status": "pending",
    "placedAt": "2025-01-02T10:55:35Z"
  },
  {
    "orderId": 2,
    "customerName": "Jonas Chen",
    "total": 197.92,
    "status": "archived",
    "placedAt": "2025-09-19T04:34:51Z"
  }
]

Export as CSV

Nested objects become dotted columns such as address.city, so the sheet stays flat; a value holding a comma, a quote or a line break would be quoted, and an array goes in as one JSON cell. The column order follows the first record that has each key.

Schema
{
  "type": "object",
  "required": ["id", "firstName", "lastName", "email", "address"],
  "properties": {
    "id": { "type": "integer" },
    "firstName": { "type": "string" },
    "lastName": { "type": "string" },
    "email": { "type": "string", "format": "email" },
    "address": {
      "type": "object",
      "required": ["city", "country"],
      "properties": {
        "city": { "type": "string" },
        "country": { "type": "string" }
      }
    }
  }
}
Mock data, CSV, 3 records, seed 1
id,firstName,lastName,email,address.city,address.country
1,Maya,Adams,maya.adams@mail.example.com,Wrocław,Poland
2,Ines,Garcia,ines.garcia@mail.example.com,Austin,United States
3,Farah,Evans,farah.evans@mail.example.com,Wrocław,Poland

Supported formats

  • JSON Schema, any draftDraft 4 to 2020-12 keywords: type and type lists, enum, const, examples, format, pattern, bounds and multipleOf, string and array sizes, uniqueItems, tuples as prefixItems or an items list, required, minProperties with additionalProperties, $ref, allOf, oneOf and anyOf.
  • OpenAPI 3.x and Swagger 2.0 documentsYAML or JSON. The schemas under components.schemas, or definitions in Swagger 2.0, are listed to pick from; nullable: true is honoured and the records are checked in the document’s own dialect.
  • Example JSONOne object, or an array of objects read as separate samples. A schema is inferred first, with required fields, nullable values and formats taken from the samples, and the records follow it.
  • JSON, NDJSON or CSV outA pretty-printed array (a single object when one record is asked for), one object per line for bulk imports and streaming tools, or CSV with dotted columns, copied or downloaded as mock-data.json, .ndjson or .csv.

Use cases

  • Fixtures for testsGenerate fifty records from the response schema with a fixed seed and commit the file: the data never drifts from the contract, or from one run to the next.
  • Fill a mock server or a prototypeBefore the backend exists, give a mock API a JSON array or a database an NDJSON file, so the front end renders names, prices and dates rather than lorem ipsum.
  • Seed a demo databaseNames, emails, addresses and amounts that look real and belong to nobody, in the exact shape of the schema, up to a thousand at a time.
  • See what a request body should look likePick a request schema from the OpenAPI document to get a complete example body, optional properties included, before writing the client that sends it.
  • Open the data in a spreadsheetThe CSV export flattens nested objects, so a schema with an address object becomes columns a filter or a pivot table can use.

Limitations

  • if/then/else and not are not appliedRecords may break a condition the schema states with them; the check beneath the output says how many fail and quotes the first reason, so nothing fails silently.
  • Patterns within reasonLiterals, classes, groups, alternatives and the usual quantifiers are sampled. Lookarounds, backreferences and negated classes are not; such a pattern gets a placeholder value and a note saying which one could not be matched.
  • One vocabulary of namesNames come from a fixed list of common given names and surnames, emails use example.com-style domains and phone numbers the 555 prefix. There are no locales to choose, and nothing is drawn from real people.
  • Recursion is cut shortA schema that references itself is generated two levels deep, then with required fields only, then stopped, so a tree comes out shallow.
  • At most 1,000 records in the pageThe count field stops there, and generation runs on every change, so a large schema with a large count can make the page pause while it works.

Frequently asked questions

How do I generate mock JSON data from a JSON Schema?

Paste the schema, choose how many records you want, and the JSON appears beside it. Every value follows the schema — types, enums, formats, patterns, minimum and maximum, string lengths, array sizes and required properties — and each record is checked against the schema afterwards, so the result says whether all of them pass. Download the records as a JSON array, as newline-delimited JSON for a bulk import, or as CSV.

Can it generate data from an OpenAPI spec?

Yes. Paste an OpenAPI 3.x or Swagger 2.0 document, YAML or JSON, and pick one of its schemas from the list — the ones under components.schemas, or definitions in Swagger 2.0. References between schemas are followed, allOf is merged, and oneOf or anyOf picks one option per record, so a polymorphic Pet comes out as a mix of cats and dogs. It is a quick way to fill a mock server or a front end before the real API exists.

How does it make the data look realistic?

By reading the property names. A firstName gets a first name and a lastName a surname, and the email in the same object is built from that same person's name; city, country and countryCode agree with one another; a price gets a sensible amount with cents, a quantity a small whole number, an age something between 18 and 90, and createdAt a recent timestamp. When the name says nothing, the schema's type and format decide. Emails and URLs use example.com and similar domains reserved for documentation, so none of them belongs to a real person.

Why do I get the same data every time?

Because the generator is seeded: the same schema, options and seed always give the same records, which keeps test fixtures and screenshots stable. Change the seed, or press "New seed", for a different set. Dates are spread over the year before 1 January 2026 rather than counted back from today, so the data does not change from one day to the next either.

Can I generate a schema-less mock from example JSON?

Yes. Paste one example object, or an array of them, and the tool works out a schema first — which properties every example has, their types and formats — and generates more records in the same shape. To see or keep that inferred schema, use the JSON Schema Validator's Generate mode.

Which schema features are supported?

type (including lists such as ["string", "null"]), enum, const, examples, format (date-time, date, time, email, uri, hostname, ipv4, ipv6, uuid, byte, password, duration), pattern for the regular expressions schemas usually use, minLength and maxLength, minimum, maximum, exclusive bounds and multipleOf, minItems, maxItems, uniqueItems and tuples, required and optional properties, $ref with recursion stopped after two levels, allOf, oneOf and anyOf. if/then/else and not are not followed; when that or an unusual pattern makes a record fail its schema, the result says so.

Is the schema or the data sent anywhere?

No. Generation runs entirely in your browser; the schema you paste and the records it produces are never uploaded or stored. Close the tab and they are gone.