Mock JSON Data Generator · Tutorial

How to create fake order data for testing

6 min readbeginnerUpdated

You are building an order list screen or an import job and need many realistic orders, each with a customer and one to four items. This tutorial writes the template, explains each placeholder, and generates a repeatable data set you can load into tests or a mock API.

What you need

Steps

  1. Start from the shape of one order

    Write one order as normal JSON, then replace the values that should vary with placeholders. The sample uses SO-{{seq:1000}} for order numbers that count up from 1000 and {{datetime:2026-01-01:2026-10-31}} for a time in that range.

  2. Pick values from a list

    "{{pick:new|paid|shipped|cancelled}}" chooses one status per order. Add an empty option to sometimes leave a field blank, as the sample does for note with {{pick:|Leave at the door|Gift wrap, please}}.

  3. Add a nested customer

    Inside customer, {{fullName}}, {{email}} and {{country}} are generated together, so the email matches the name, for example grace.larsen@test.example for Grace Larsen.

  4. Make a list of line items

    The items array starts with "{{repeat:1-4}}", followed by the template for one item. Each order gets one to four items, each with its own SKU, quantity and price. Because "{{int:1-5}}" is the whole string, quantity is a real number in the output.

    "items": ["{{repeat:1-4}}", {
      "sku": "SKU-{{int:100-999}}",
      "quantity": "{{int:1-5}}",
      "price": "{{price:4-250}}"
    }]
  5. Generate and keep it repeatable

    Set Records to 500. Keep the seed as it is so the same orders come back every time your tests run. Choose JSON Lines if you plan to stream the records into a database or a log pipeline.

  6. Download and use it

    Press Download to save mock-data.json. Serve it from a mock API, load it in a test fixture, or convert it to SQL inserts with JSON Converter.

Try it yourself

Opens the Mock JSON Data Generator with this tutorial's sample loaded.

Try it now

Common mistakes

Quoting numbers by accident
"Qty: {{int:1-5}}" produces text because the placeholder is only part of the string. Use "{{int:1-5}}" on its own when you need a number.
Huge repeat ranges
{{repeat:100-1000}} inside 10,000 records creates millions of values. The generator stops before the browser runs out of memory; lower the counts.
Forgetting the seed in shared tests
If teammates press New, their data will differ from yours. Agree on a seed and write it in the test's README.

Next steps

Go back to the Mock JSON Data Generator, or keep going with one of these:

FAQ

Can the dates be in a different format?

{{date}} gives YYYY-MM-DD and {{datetime}} gives an ISO date-time, the most portable formats. Reformat them in code if you need another style.

How do I number records from 1?

Use {{index}}, which is the record's position, or {{seq:1}} for a counter that also works inside lists.