JSON Generator

GenerateReset
FeedbackHelpAbout

Paste your
template here

Click "Generate"
and wait for
a magic here

{{repeat(min, max)}}Integer
Specifies the number of template repeats in the array. Should be the first item of array. If "max" param is set, it generates random repeats number in range from "min" to "max".
{{index}}Integer
Increment, starting from 1.
{{numeric(min, max)}}Integer or Float
Can be negative. Generates random number in range from "min" to "max". If "min" is float, generated number will be float too.
{{bool}}Boolean
Random true/false
{{firstName}}, {{lastName}}String
Random name, surname. Last name will be used in email generation.
{{company}}String
Random company name.
{{phone}}String
Random phone number.
{{email}}String
Email, generated base on {{firstName}} and {{company}}.
{{city}}String
String. Random US city.
{{street}}String
Random US street.
{{date(format)}}String

Random date. Also formats date according to "format" string. Format string may consist of any characters, but some of them considered tokens, and will be replaced by appropriate value from date.

Possible tokens include:

  • YYYY: 4-digit year
  • YY: last 2 digit of year
  • MM: ISO8601-compatible number of month (i.e. zero-padded) in year (with January being 1st month)
  • M: number of month in year without zero-padding (with January being 1st month)
  • dd: zero-padded number of day in month
  • d: number of day in month
  • hh: zero-padded hour
  • h: hour
  • mm: zero-padded minutes
  • m: minutes
  • ss: zero-padded seconds
  • s: seconds
  • TZ: time-zone in ISO8601-compatible format (i.e. "-04:00")

Longer tokens take precedence over shorter ones (so "MM" will aways be "04", not "44" in april).

{{guid}}String
A globally unique identifier. You canread moreabout it.
{{lorem(n)}}String
Generate "n" lorem words. It will be grouped in sentences.
function(idx)Function
Create your custom function, that returns any value. Passed params: "idx" (index of current cloned object). "this" keyword contains generation methods.

About

All we ever faced the problem of lack of information in our app. All interfaces seem lifeless and empty. Debugging with no data is also not simple.

I think that each of us has at least once in their lives created a bunch of files withJSONdata, but they were just one object propagated without unique fields. JSON Generator was created in order to help with this. It provides an opportunity generate any data and in any quantity. Edit template, click "Generate" and you're done.

Usage

JSON Generator has a convenient syntax. You can specify JavaScript object for template that you see in the left box. It will be cloned in infinite depth. Fields may have any name and value, but it must be valid JavaScript. Values may contain one or more template tags. When you generate the data source object to be copied several times and the place of tags will be inserted random values. You can resize template field by dragging center divider.

You can copy the generated JSON to clipboard by clicking "Copy". If you click "Save", JSON will be stored on the server and you can download generated file by clicking "Download" button or access it via ajax-request by URL that will be copied to clipboard after clicking "Copy URL" button. Yes, JSON Generator canJSONP:) Generated files are stored 30 days and their size does not exceed 150 kB. Size appears at the top right of the field with the generated data. If file size text is red - file is too large for saving on server, but you can copy it to your clipboard and save locally to *.json file.

JSON Generator remembers your last template in localStorage. If you want to reset it, click "Reset" button or clear template field and refresh page.

If you have found a bug, you have a suggestion for improving the application or vay just want to thank me, click on "Feedback".

Find a bug? Have an idea?
Wanna give me a high five?

[
    '{{repeat(5)}}',
    {
        id: '{{index}}',
        guid: '{{guid}}',
        picture: 'http://placehold.it/32x32',
        age: '{{numeric(20,40)}}',
        name: '{{firstName}} {{lastName}}',
        gender: function(idx) {
            return this.bool() ? 'male' : 'female';
        },
        company: '{{company}}',
        phone: '{{phone}}',
        email: '{{email}}',
        address: '{{numeric(10000,40000)}}, {{city}}, {{street}}',
        about: '{{lorem(50,100)}}',
        registered: '{{date(YYYY-MM-ddThh:mm:ss Z)}}',
        tags: [
            '{{repeat(7)}}',
            '{{lorem(1)}}'
        ],
        friends: [
            '{{repeat(3)}}',
            {
                id: '{{index}}',
                name: '{{firstName}} {{lastName}}'
            }
        ]
    }
]