JSON Generator

Generate a sample JSON object with a random id and the current timestamp in one click. Built in your browser.

What the JSON Generator does

This JSON generator creates a small random sample JSON object you can copy straight into a test, a mock server or a request body. Press Run Tool and the output box fills with one formatted object. The shape is always the same, but two fields change on every run:

{
  "id": "k3f9q2p1x7a",
  "name": "Sample",
  "active": true,
  "createdAt": "2026-09-01T09:42:18.204Z"
}

id is a short random string from Math.random().toString(36), name is always "Sample", active is always true, and createdAt is the moment you clicked, formatted as an ISO 8601 timestamp with new Date().toISOString(). The output is indented with two spaces and is always valid JSON.

How to use it

  1. Click Run Tool. Anything in the input box is ignored; the object is built from scratch.
  2. Click Copy to put the object on your clipboard.
  3. Click Run Tool again whenever you need a fresh id and timestamp, for example one per test case.

The four fields in detail

Worked examples

1. A POST body for an API stub

Click Run Tool, then Copy, and paste the minified object into curl:

curl -X POST https://api.example.com/items \
  -H "Content-Type: application/json" \
  -d '{"id":"9qz2m4k7p1a","name":"Sample","active":true,"createdAt":"2026-09-01T09:42:18.204Z"}'

2. Testing date parsing

Because createdAt is a real timestamp, the object is a quick check that your stack parses ISO 8601 with milliseconds:

// JavaScript
new Date(obj.createdAt).getTime();                 // milliseconds since 1970

# Python 3.11+
datetime.fromisoformat(obj["createdAt"])           # aware datetime in UTC

// Java
Instant.parse(obj.getString("createdAt"));

Older Python versions (3.10 and earlier) reject the trailing Z in fromisoformat; replace it with +00:00 first.

3. Many objects with the same shape

The page generates one object per click. When you need a list, the same logic runs in a line of JavaScript in your browser console or Node.js:

const rows = Array.from({ length: 5 }, () => ({
  id: Math.random().toString(36).slice(2),
  name: 'Sample',
  active: true,
  createdAt: new Date().toISOString()
}));
console.log(JSON.stringify(rows, null, 2));

Objects made in the same loop share almost the same createdAt; add an offset such as new Date(Date.now() - i * 60000) if you need distinct times.

Limits to know

The generator is a starting point, not a schema engine. You cannot choose fields, types or the number of objects on this page, and the id is not guaranteed unique: Math.random() is not a cryptographic source, so do not use it for tokens, secrets or primary keys in production. For test fixtures and demos it is fine.

Because id and createdAt change on every run, do not paste a generated object into a snapshot test and expect it to match next time. Either freeze the two values by hand after copying, or assert on their shape instead, for example expect(obj).toEqual({ id: expect.any(String), name: 'Sample', active: true, createdAt: expect.any(String) }) in Jest.

Which generator to use

Use this page when you need one valid object immediately. For realistic test data with names, emails, addresses, dates and UUIDs across many rows, exported as JSON, CSV or SQL, use the mock data generator. For ready-made files with arrays and nested objects, download one of the sample JSON files. For a real RFC 4122 identifier use the UUID generator, and for random timestamps across a range use the random date generator. To grow the generated object into a bigger structure, paste it into the online JSON editor and add fields with live validation.

Frequently asked questions

What exactly does the JSON Generator produce?

One pretty-printed JSON object with four fields: id (a short random base-36 string), name (the literal value "Sample"), active (the boolean true) and createdAt (the current time as an ISO 8601 string in UTC). Press Run Tool again for a new id and timestamp.

Does the input box affect the output?

No. The object is created from scratch each time, so anything typed in the input box is ignored. The box is shared with other modes of the same tool. Edit the generated object by hand, or in the online JSON editor, to change the shape.

Is the random id unique?

It comes from Math.random().toString(36) and is about 11 characters long, so collisions are very unlikely in small test sets, but it is not guaranteed unique or secure. Use the UUID generator for real identifiers.

Can I generate an array of JSON objects?

Not on this page. Run the one-line JavaScript loop shown above in your browser console, or use the mock data generator, which creates many rows at once.

Is anything sent to a server?

No. The object is built in your browser with JavaScript. Nothing is uploaded or stored, and the tool works offline once the page has loaded.