Skip to content
AgileLogics

Random JSON Generator

Generates a JSON array of sample objects (id, name, value, active), each with randomized values, for mocking API responses or seed data.

How it works

Choose how many objects, then click Generate.

What does the random JSON generator create?

It creates a JSON array of sample objects, from 1 to 50 of them (5 by default). Each object has the same four fields: an id counting up from 1, a name of 3 to 8 random lowercase letters, an integer value from 1 to 1000 and an active boolean. Output is pretty-printed with 2-space indentation and is always valid JSON.

Think of it as instant filler for a list endpoint: enough structure to render a table, page through results or test a filter, without writing fixtures by hand.

Field reference

Field JSON type Possible values How it's generated
id number 1 up to the object count Sequential, not random
name string 3 to 8 letters, a to z Length and each letter picked at random
value number Whole numbers 1 to 1000 Uniform random integer
active boolean true or false 50/50 coin flip

All random choices use crypto.getRandomValues() with rejection sampling, so no value in a range is favoured.

Generating an array

  1. Set the Objects slider (1 to 50).
  2. Click Generate.
  3. Click Copy and paste into your mock file, test or API stub.

Two objects looked like this:

[
  {
    "id": 1,
    "name": "tgmjnei",
    "value": 572,
    "active": false
  },
  {
    "id": 2,
    "name": "qhyknrvo",
    "value": 79,
    "active": false
  }
]

Notice both objects came out inactive. That happens more often than people expect: with 5 objects there's a 1 in 32 chance (about 3%) that every active is false, and the same for all true. If your UI has a "show active only" filter, keep generating small batches and you'll eventually get to test the empty state for free.

Where it's useful

  • Front-end work before the API exists. Return the array from a stubbed fetch and build the list view against it.
  • Pagination and scrolling. 50 objects is enough to see a second page at typical page sizes of 10 or 20.
  • Sorting checks. Sorting by value exercises numeric sort; sorting by name exercises string sort. A table that sorts 79 after 572 is comparing numbers as strings.
  • Teaching JSON. The four fields cover three of the value types JSON defines: number, string and boolean.

What it doesn't generate

The schema is fixed, and the data is deliberately plain. You won't get:

  • nested objects or arrays inside an object
  • null values or missing fields
  • decimals, negative numbers or very large numbers
  • strings with spaces, accents, emoji or characters that need escaping, like " or \
  • realistic names, emails or dates

Those are exactly the inputs that break JSON handling code, so add a few by hand once your happy path works. The format itself is defined in RFC 8259, which spells out the escaping rules for strings and the limits on number formats if you want to craft edge cases deliberately.

Next steps with the output

Paste the array into the JSON formatter to re-indent it or collapse it, or the JSON validator after you've hand-edited it, since a missing comma is the usual casualty. The JSONPath tester is a quick way to practise queries such as selecting every name. And if someone non-technical needs to see the data, the JSON to Excel converter turns the array into a spreadsheet with one row per object.

Last updated

Frequently asked questions

Can I change the fields or add my own?
No. Every object has the same four fields, id, name, value and active. Edit the output afterwards, or use it as a starting point and extend it in a JSON editor.
Are the ids random?
No, they count up from 1 in each batch, so a batch of 5 always has ids 1 to 5. That keeps them unique within a batch, but two batches merged together will have clashing ids.
Is the output valid JSON?
Yes. It's produced by JSON.stringify with 2-space indentation, so it's a valid JSON array under RFC 8259 that any JSON parser will accept.
Is any data sent to a server?
No. The objects are built in your browser using crypto.getRandomValues, and the page makes no network request.