Toolbox for developers / Online JSON generator

JSON generator

This tool allows you to generate random JSON files from a template.

You can generate multiple JSON files at the same time (exported to a single ZIP file).

Short user guide: Fill in the editor "Your JSON template" and click on the "Generate" button. The "JSON generated" editor will contain the result.
The editor contains only the first JSON file generated. You can dowload the other JSON files below the editor. You can also download a ZIP file containing all the generated JSON files.

You can see the user guide to help you to use this JSON Generator Online.

Your JSON template


JSON generated



Options for exporting generated JSON files






User guide

This tool allows to generate JSON data, and export the generated JSON files.

Type in the editor "Your JSON template" your template. On the right side of the page, you have an "Available tags" section which shows you the available tags that you can use.

Below the editors, you can indicate the number of json files that you want to generate.

Click on the "generate" button to generate your json data.
The editor "JSON generated" only contains the first JSON file. The buttons "copy to clipboard" and "download" allows you to retrieve the first JSON file.
All the generated json files are available below the editors.


Why generate JSON files ?

Sometimes it is necessary to have JSON data in order to make tests.

This dataset generator allows you to meet this need, you can generate JSON files with a few clicks.

This tool is currently in beta. Do not hesitate to make a comment in order to indicate the features which seem useful to you!


You can report a bug or give feedback by adding a comment (below) or by clicking "Contact me" link (at the top right hand corner of the page).

Comments





Available tags
choice
choice('string1', 'string2', 'string3', ...)
Returns one of the strings passed in parameter.
random
random(min, max)
Returns a random integer.
Min and max are optional.
Min equals 0 by default.
Max equals 2^53 -1 by default.
randomFloat
randomFloat(min, max, scale)
Returns a random float.
Min, max and scale are optional.
Min equals 0 by default.
Max equals 2^53 -1 by default.
Scale equals 2 by default.
randomBool
randomBool()
Returns a random boolean.
repeat
repeat(numberOfTime, elementToRepeat)
Duplicate an element, and return the result in an array.
In this example, it generates an array containing 5 first names:

repeat(5, firstname())

date
date(format, from, to)
Returns a random date.
From and To are optional.
From equals 1900-01-01 by default.
To equals 2100-01-01 by default.

Example 1: GMT date format
date('Y-m-d H:i:s') returns '2001-03-10 17:16:18'

Example 2:
date('F j, Y, g:i a') returns 'March 10, 2001, 5:16 pm'

Example 3:
date('m.d.y') returns '03.10.01'

Example 4:
date('j, n, Y') returns '10, 3, 2001'

Example 5:
date('Ymd') returns '20010310'

Example 6:
date('D M j G:i:s T Y') returns 'Sat Mar 10 17:16:18 MST 2001'

For more details: https://www.php.net/manual/en/function.date.php
Regular expression
regex(reguarExpression)
Returns a random string that matches a given RegExp Javascript object.

Example:
regex(/hello+ (world|to you)/) can return 'helloooooooo world' or helloo to you'
It uses randexp.js (MIT License)
Call a JavaScript function
function () { ... }
Returns the result of the function.
'this' represents the JSON object where the function is located.
index
index(start)
Returns the index of the element.
Start is optional.
Start equals 0 by default.
firstname
firstname()
Returns a random firstname.
lastname
lastname()
Returns a random lastname.
country
country()
Returns a random country.
countryCode
countryCode()
Returns a random country code (two characters).
city
city()
Returns a random city.

Disclaimer: The tools are provided "as is", without warranty of any kind, either express or implied.
Any links to third-party website or software available on this website are provided "as is",
without warranty of any kind, either express or implied and are to be used at your own risk.