The most elegant way to create random data

With help of powerful and flexible templates written in good old JavaScript.

What is this?

Have you ever needed to craft mock data for API or script testing? Creating a single record of semi-realistic structured data isn’t that hard. But do it at scale, with say, thousands of records can be a daunting task.

Enter JSON Generator, a tool that handles the heavy lifting for generating structured JSON objects, stuffed with sequenced and/or controllable random data.

Write your code

JSON Generator has an easy, but powerful templating language. Let's dive right in with some simple examples:

using builtin generators

JG.repeat(2, 5, {
  id: JG.objectId(),
  name: `${JG.firstName()} ${JG.lastName()}`,
  company: JG.company(),
  address: `${JG.integer(1, 100)} ${JG.street()}, ${JG.city()}, ${JG.state()}`,
  about: JG.loremIpsum({ units: 'sentences', count: 2 }),
});

or custom generators

JG.repeat(3, {
  phone() {
    const num = _.shuffle(_.range(10));
    let i = 0;
    return '+1 (xxx) xxx-xxxx'.replace(/x/g, () => num[i++]);
  }
});

Get generated random data

Generated data is stored on the server. You can simply copy data and store it locally or fetch it through the API.

.json

[
  {
    "id": "600dc3b5d617e547a0e74cb9",
    "name": "Mitchell Fitzgerald",
    "about": "Proident voluptate veniam voluptate mollit reprehenderit anim officia et ea ex laboris nulla laboris. Nulla ut aliquip fugiat tempor veniam sint aliqua reprehenderit tempor Lorem commodo anim.",
    "address": "48 Flatlands Avenue, Cutter, North Dakota",
    "company": "Scenty"
  },
  {
    "id": "600dc3b5c4e60ba2ebf06569",
    "name": "Howell Faulkner",
    "about": "Mollit Lorem reprehenderit qui elit id aliqua. Deserunt ipsum ad cupidatat ullamco ut aliqua est do consectetur nostrud sit esse.",
    "address": "77 Hemlock Street, Hasty, Florida",
    "company": "Fleetmix"
  }
]

.json

[
  {
    "phone": "+1 (149) 760-2835"
  },
  {
    "phone": "+1 (135) 972-8640"
  },
  {
    "phone": "+1 (213) 854-9760"
  }
]

Fetch it from API

JSON Generator has a convenient REST API. You can fetch your data with the HTTP request.

  curl --request GET -H "Authorization: Bearer R4iN..." --url https://api.json-generator.com/templates/tAu-9/data

This is that simple!

What are you waiting for? Get Started