How to Generate Sample JSON Data for Testing

How to Generate Sample JSON Data for Testing

Most apps, tests and demos need data before the real data exists. A new list screen needs ten users to look right, a search box needs products with different prices and stock levels, and a test needs the same input every time so a failure means something. Writing that data by hand is slow, and it hides the edge cases — an empty list, a long name, a price of zero — that break real interfaces.

In this guide you will generate sample JSON data with the free JSON Template Creator, in three steps: pick a template, set how many records you need, and generate. You will then check the result with the JSON Formatter. Everything runs in your browser, nothing is uploaded, and you can generate up to 100 records at a time.

Why sample JSON is needed

Good sample data does three jobs. First, it lets you build and test a screen before the backend is ready, so design and development are not blocked. Second, it gives you variety: different names, prices, dates and states, so you can see whether a layout survives long text or an out-of-stock item. Third, it makes tests repeatable. For the same input, the Template Creator returns the same output, so a failure points to your code rather than to changed data.

Generate sample JSON in 3 steps

Step 1 — Pick a template and edit it

Open the JSON Template Creator and choose a starting template: User profile, Product, Address, API response, To-do list, App settings or Blog post. Each one is a single JSON object with example values. Edit the keys and values until they match your app — rename fullName to name if that is what your code expects, add a field such as “city”: “Pune”, or remove a field you do not need. You can also paste your own JSON object instead.

Step 2 — Choose how many records you need

Set Records to the number you need, up to 100, and click Generate records. The tool keeps your structure and fills each record with different but realistic values: id counts up, dates move forward one day per record, emails and usernames get matching fictional names, and prices and quantities change within a sensible range. Fields it does not recognise, such as currency or theme, keep the value you typed.

Step 3 — Copy or download the result

Click Copy to paste the JSON into your app or test, or Download .json to save it as a file. The output is an array of records, ready to load. If you need to start again, Reset template restores the original template. For the same data over HTTP, try the Fake API.

Worked example: ten users and five products

Suppose you need data for a small shop screen. First, choose the User profile template, set Records to 10 and click Generate records. You get an array of ten users with ids 1 to 10, different names, matching emails such as priya.silva2@example.com, a mix of active and inactive accounts and creation dates one day apart. Then do the same with the Product template, for 5 records.

A product record keeps the fields your catalogue needs — price, stock, tags and nested dimensions — with a different value in each record, so you can test sorting by price, filtering by tag and the out-of-stock state without inventing the data yourself. A shortened example looks like this:

[
  {
    "id": 1,
    "name": "Example product",
    "price": 19.99,
    "inStock": true,
    "tags": ["new"]
  }
]

Validate the output with the JSON Formatter

Generated JSON should still be checked before you rely on it, especially after you edit a template by hand. Copy the output, open the JSON Formatter, paste it in and click Format or Validate only. Valid JSON will be neatly indented; invalid JSON will show the parser’s error message, with a line and column where available. The most common mistakes are a trailing comma, single quotes instead of double quotes and an unquoted key. Fix one problem, validate again, and only then load the data into your app.

Frequently asked questions

Do I need to sign up or install anything?

No. The Template Creator runs in your browser, needs no account and sends nothing to a server.

Is the generated data real?

No. Names, emails and addresses are fictional, and emails use example domains. Do not treat them as real people or use them in production.

Can I use my own field names?

Yes. Paste your own JSON object, edit any key, and use Validate in the tool to confirm the result is correct JSON before you generate records.

Limitations

The Template Creator is a free, in-browser tool for sample data, not a database or a production data source. It generates up to 100 records at a time, values are fictional, and it cannot connect to your real data or keep records in sync. Treat its output as a starting point: check the fields, validate the JSON and replace it with real data before you launch.

Pick a template, generate the records you need and validate the result. In a few minutes you will have realistic, repeatable JSON to build and test with — without waiting for a backend.