Generate fake JSON data

generate N JSON records that match a simple schema using Faker (fr_FR or en_US locale)

What is mock data for?

The need recurs at every stage of the development cycle. For a demo, you need plausible users, not truncated Lorem Ipsum. For integration tests, you want a reproducible but varied dataset. For a pre-production environment isolated from GDPR, you replace real data with fake equivalents. For a UI mockup, tables need to be populated with credible entries. The mock data generator covers these cases by producing JSON records matching a simple schema.

The schema format

The schema is a JSON object where each key is the name of the produced field and the value is a Faker type. For example:

{
  "name": "name",
  "email": "email",
  "age": "number 18-65",
  "active": "boolean",
  "registered_on": "date"
}

The tool then generates N records matching this schema, in the chosen locale (French or English). The result is a JSON array usable directly as a fixture, as an API request body, or as input for a database seeder.

Supported types

  • name: full name ("Marie Dupont").
  • firstName / lastName: first name and last name separately.
  • email: fake email address (uses Faker's safeEmail, which produces reserved example.com domains that cannot receive mail).
  • phone: phone number formatted to the locale.
  • address: full postal address.
  • number: random integer between 0 and 1000 by default, or number a-b for a custom range.
  • boolean: random true or false.
  • date: date in ISO 8601 format (YYYY-MM-DD).
  • uuid: UUID v4.
  • text: short lorem-ipsum-like paragraph (~120 characters).
  • string: three random words.
  • url: fake URL (https://example.org/...).

Any unrecognised type is kept as is in the result. This is a choice: if you put "role": "admin" in the schema, each record will have "role": "admin". This lets you mix constant values and dynamic fields without changing tool.

Locale choice

Faker has dozens of locales. The tool exposes the two most useful in a francophone context:

  • fr_FR: French names, French addresses, French-format phone numbers, lorem-ipsum sentences in approximate French.
  • en_US: American names and addresses, US-format phone numbers.

For a demo's consistency on the French side, pick fr_FR. For an internationalisation test, mix the two runs or increase the record count to get a variety of origins.

Use cases

  • Test fixtures: generate 50 users, paste them into an AliceBundle YAML file or a seeder. Reproducible when a Faker seed is fixed, varied otherwise.
  • UI mockups: fill a React/Vue table with plausible data. Much more meaningful than an empty table or foo / bar / baz.
  • Load testing: generate a large JSON payload for a throughput test (k6, JMeter, Locust).
  • Sales demos: populate a demo instance with entries that resemble real cases but do not risk leaking sensitive information.
  • Anonymisation: replace a production export with a fake equivalent before sharing it with a subcontractor or using it in pre-production.

Intentional limits

To stay simple to use, the tool does not support nested schemas (a field that would itself be an object or an array of objects). For such needs, it is better to write a dedicated Faker script, or compose several successive calls. The intentional limit also avoids absurd combinations ("items": "name" with random cardinality) which would make the tool less predictable.

The number of records is capped at 500. Beyond that, a test environment is expected to generate its fixtures via dedicated code (Faker CLI, Foundry, factory_bot, etc.). The web tool is useful up to a few hundred records; beyond that, memory and response time cap the experience.

Reproducibility and security

Values are produced with a non-deterministic PRNG: each run produces different data. For tests that must be reproducible (CI), capture the output once and commit it. For really sensitive data (production anonymisation), keep in mind that generation on a public server is not the right channel: prefer a local script that never leaves your machine.

Frequently asked questions

Are the generated emails valid?

The format is valid (RFC 5322), but the domain is example.com or an equivalent reserved by IANA. None of these emails can receive a message; this is intentional to avoid accidental spam on real addresses.

Can I get the same dataset several times?

Not via the web interface: the tool does not fix a seed. For strict reproducibility, script the generation locally with Faker and a fixed seed ($faker->seed(1234);).

How do I generate a nested object?

The tool only supports a flat schema. For nested data, post-process the output with a script or directly write the matching Faker code.

Why are my numbers all between 0 and 1000?

That is the default range. Specify a range: "age": "number 18-65", "price": "number 1-9999", etc.

How does it relate to other tools on the site?

For UUIDs in bulk, see the UUID generator. For passwords, the password generator. For text, the text generator. The mock data generator is the cross-cutting tool that combines several of these generations.

Example request

curl -X POST https://cdrn.fr/api/v1/tools/mock-data-generator/execute \
  -H "Content-Type: application/json" \
  -d '{"schema":"{\"name\": \"name\", \"email\": \"email\", \"age\": \"number 18-65\"}","count":5,"locale":"fr_FR"}'

Input schema

Field Type Required Default
schema text {"name": "name", "email": "email", "age": "number 18-65"}
count integer 5
locale choice (fr_FR, en_US) fr_FR

Endpoints

  • GET https://cdrn.fr/api/v1/tools - lists every available tool
  • GET https://cdrn.fr/api/v1/tools/mock-data-generator - returns the schema for this tool
  • POST https://cdrn.fr/api/v1/tools/mock-data-generator/execute - runs this tool with a JSON payload