Template Functions Documentation - Complete Guide | JSON Generator
Documentation

Template Functions

Complete reference guide for all available template functions. Learn how to generate realistic mock data for your applications.

Quick Start

Basic Syntax

{{functionName()}}

All functions are wrapped in double curly braces

With Parameters

{{int(1,100)}}

Some functions accept parameters for customization

Special Features

{{repeat(min, max)}} Array Repetition

Repeats array elements a random number of times between min and max

[
{{repeat(2, 4)}},
{
"name": "{{firstName()}}"
}
]

Generates 2-4 objects with random names

this.field Cross-references

Reference other fields in the same object using "this." syntax

{
"age": "{{int(18, 65)}}",
"message": "I am this.age years old"
}

The "this.age" will be replaced with the actual age value

Identifiers & IDs

{{ulid()}} ULID

Generates a Universally Unique Lexicographically Sortable Identifier

01ARZ3NDEKTSV4RRFFQ69G5FAV
{{uuid()}} UUID v4

Generates a random UUID version 4

f47ac10b-58cc-4372-a567-0e02b2c3d479
{{uuidv7()}} UUID v7

Generates a time-ordered UUID version 7

01890a5d-ac96-774b-bcce-b302099a8057
{{objectId()}} MongoDB ObjectId

Generates a MongoDB-style ObjectId

507f1f77bcf86cd799439011

Numbers & Booleans

{{int()}} Random Integer

Generates a random integer. Optional min/max parameters.

{{int()}} → 42
{{int(1,100)}} → 73
{{int(10)}} → 7
{{float()}} Random Float

Generates a random float number

{{float()}} → 3.14159
{{float(0,1)}} → 0.73
{{float(100)}} → 87.23
{{double()}} Random Double

Generates a random double precision number

{{double()}} → 123.456789
{{double(1,100)}} → 36.21
{{double(10)}} → 7.52
{{bool()}} Random Boolean

Generates a random true/false value

true or false

Dates & Times

{{date()}} Random Date

Generates a random date in YYYY-MM-DD format

2023-07-15
{{dateTime()}} Random DateTime

Generates a random datetime with time

2023-07-15 14:30:25
{{dateRange()}} Custom date range
{{dateRange('2021-01-01','2023-12-31')}}

Generates a date within specified range

→ 2022-06-15
{{dateTimeRange()}} Custom datetime range
{{dateTimeRange('2022-01-01 00:00:00','2023-12-31 23:59:59')}}

Generates a datetime within specified range

→ 2022-08-15 16:42:33

Enums & Text

{{enum('v1','v2')}} Choose from options
{{enum('value1', 'value2', 'value3')}}

Randomly selects one value from the provided options. Supports strings and numbers.

String Examples:

{{enum('active', 'inactive', 'pending')}}
{{enum('red', 'blue', 'green')}}

Mixed Examples:

{{enum(1, 2, 3, '4', 5)}}
{{enum('small', 'medium', 'large')}}
Spaces around values are automatically trimmed. Both quoted and unquoted values are supported.
{{randomString(length)}} Random String

Generates a random string of specified length

{{randomString(10)}} → aB3xY7qM9z

Personal Information

{{firstName()}}

Random first name

{{lastName()}}

Random last name

{{middleName()}}

Random middle name

{{surname()}}

Random surname

{{gender()}}

Random gender

{{email()}}

Random email address

{{username()}}

Random username

{{password()}}

Random password

{{phoneNumber()}}

Random phone number

Address & Location

{{street()}}

Random street address

{{city()}}

Random city name

{{state()}}

Random state/province

{{country()}}

Random country name

{{zipCode()}}

Random postal code

{{latitude()}}

Random latitude

{{longitude()}}

Random longitude

Work & Business

{{companyName()}}

Random company name

{{jobTitle()}}

Random job title

{{jobArea()}}

Random job area

{{jobType()}}

Random job type

{{jobDescriptor()}}

Random job descriptor

{{department()}}

Random department

Internet & Network

{{url()}}

Random URL

{{domainName()}}

Random domain name

{{ip()}}

Random IP (v4 or v6)

{{ipv4()}}

Random IPv4 address

{{ipv6()}}

Random IPv6 address

{{mac()}}

Random MAC address

Products

{{productName()}} Product name
{{price()}} Product price
{{productMaterial()}} Material type
{{productDescription()}} Product description
{{productAdjective()}} Product adjective

Finance

{{creditCard()}} Credit card number
{{cvv()}} CVV code
{{issuer()}} Card issuer

Travel & Airlines

{{airlineName()}} Airline name
{{aircraftType()}} Aircraft type
{{airportName()}} Airport name
{{flightNumber()}} Flight number
{{seat()}} Seat assignment

Other

{{ISBN()}} ISBN (any format)
{{ISBN13()}} ISBN-13 format
{{ISBN10()}} ISBN-10 format
{{image()}} Image URL

Let Us Know!

Missing a function you need? Have ideas for new features? We'd love to hear from you!

New Functions

Need a specific data generator? Tell us what you're missing!

Feature Ideas

Have an idea to make JSON Generator better? We're all ears!

Bug Reports

Found something that doesn't work? Let us know so we can fix it!

Quick tip: When requesting new functions, please include:

  • • What type of data you need to generate
  • • Example of expected output
  • • Your use case or scenario