By · Updated

JSON Generator

Seeded Fixture Records From Typed Fields Such as uuid, date and enum

No ratings yet

OneTask is free, with no sign-up, and built by one person.
If this tool saved you time, a coffee helps keep new ones coming.

How the JSON Generator works

This JSON generator builds realistic fake data from a template. Front-end work stalls when the API is not ready, tests need fixtures, and demos need something that looks like real data. List the fields you want and their types, pick how many records, and this tool writes the JSON. The same seed always produces the same output, so fixtures stay stable across runs and teammates get identical data from the same spec.

JSON generator: templates and field types

Hand-writing mock data is tedious and the result is always three records called "Test 1", "Test 2" and "asdf". A generator gives you fifty plausible records in seconds, and a deterministic one means you can paste the spec into a README and everyone regenerates the same file.

Describing fields. Each line is name: type. The name becomes the JSON key exactly as typed, so nested paths and spaces are allowed but you probably want plain identifiers. The type selects a value generator:

Anything unrecognised falls back to a two-word string, so a typo never breaks the output — it just gives you words where you expected something else.

Ranges and enums. int(18,80) and float(0,1) take inclusive bounds; floats are rounded to two decimal places. enum(free|pro|team) distributes values roughly evenly. Both are enough to model status fields, ratings, quantities and the like without a full expression language.

Seeds and reproducibility. The generator uses a small linear congruential random number generator seeded from the seed field, not Math.random(). Given the same spec, count and seed the output is byte-identical every time, in every browser. Change the seed to get a fresh dataset with the same shape; keep it fixed when the data feeds snapshot tests.

Output shapes. An array of objects is the common REST list response. "Object with data array" wraps the records as {"data": [...], "total": n}, which matches many paginated APIs and lets you test envelope handling. "Single object" returns just the first record for detail endpoints. Formatting options cover the usual indent styles plus minified for embedding in a fixture string.

Limits. Up to 1000 records per run. Values are drawn from short built-in word lists — a twenty-name pool means duplicate names appear in large sets, which is realistic enough for layout and pagination testing. If you need unique names for every row, combine firstname with an id field or use uuid.

Where this fits. Pair the output with a static file server or a mock API tool for front-end development, drop it into test fixtures, or use it to seed a demo database. The JSON to YAML converter on this site turns it into YAML for config-style fixtures.

FAQ

Why do I get the same data every time?

Because the seed is fixed. Deterministic output is a feature: it keeps fixtures and snapshot tests stable and means a colleague can regenerate your exact file from the spec. Change the seed number to get different values with the same structure.

How do I make nested objects?

This generator produces flat records. For a nested shape, generate each level separately and compose them, or use a dotted key like address.city and post-process. Keeping the tool flat keeps the spec format trivial, which is the point for quick fixtures.

Can I add my own list of values?

Yes, with enum(...). Put your values inside the parentheses separated by vertical bars, for example status: enum(draft|published|archived). Each record picks one at random from the list.

Are the emails and phone numbers real?

No. Emails use the reserved example.com domain, which is guaranteed never to deliver mail, and phone numbers follow a UK mobile pattern without being verified. Nothing here corresponds to a real person.

What happens with an unknown type?

It falls back to a short random string so the output still validates as JSON. Check the field in the output; if you see two lorem words where you expected a number, the type name is misspelt.

See also: all Dev Utilities tools, Formatters & Validators, Data & Encoding, Security & Identifiers, SEO, Accessibility, AI.

Related tools