Placeholders

Each placeholder serves as a place where the new, random value will be replaced in the output.

Generally each placeholder is enclosed between {{ and }}. So for example:

{{placeholder}}

Some placeholders accept arguments and some arguments can be required or optional. See below details of each placeholder.

Optional placeholder within the table is denoted by [ arg ].

Placeholder

Description

name([m,f])

Generic full name

first_name([m,f])

Generic first name

last_name([m,f])

Generic last name

number(l,h)

Number between l (inclusive) to h (exclusive)

age

Number between 1 and 99. Equal to number(1,100)

city

Generic city name

street_address

Generic street address

lorem(n)

Generic lorem ipsum text contaning n words

empty

Empty string field

range(prop,n,[m])

Generates property with “prop” name and array as its value

bool

Boolean value - true / false

option(arg1,arg2,…,argN)

Choose randomly one of the argument.

Defined placeholders

Follows a description of each defined placeholder available to use.

Note

Internally JDOG is using amazing Faker package to generate random values.

name([m,f])

Generic person full name - that is the first and last name.

Arguments

Optional m - Generates male names.

Optional f - Generates female names.

If none of these arguments is provided then generates a male or female name.

Example

{
    "full_name": "{{name}}"
}

# Example output

{
    "full_name": "Joe Hill"
}

first_name([m,f])

Generic person first name.

Arguments

Optional m - Generates male names.

Optional f - Generates female names.

If none of these arguments is provided then generates a male or female name.

Example

{
    "first": "{{first_name(m)}}"
}

# Example output

{
    "first": "Joe"
}

last_name([m,f])

Generic person last name.

Arguments

Optional m - Generates male names.

Optional f - Generates female names.

If none of these arguments is provided then generates a male or female name.

Example

{
    "last": "{{last_name(f)}}"
}

# Example output

{
    "last": "Hills"
}

number(l,h)

Generates number between l and h. Note that h is exclusive.

Arguments

  • l - left boundary, inclusive

  • h - right boundary, exclusive

Example

{
    "age": "{{number(1,100)}}"
}

# Example output

{
    "age": "42"
}

age

A random number from 1 to 99. Effectively the same as using {{number(1,100)}}.

Arguments

None.

Example

{
    "age": "{{age}}"
}

# Example output

{
    "age": "42"
}

city

City name.

Arguments

None

Example

{
    "born_city": "{{city}}"
}

# Example output

{
    "born_city": "Coruscant"
}

street_address

Generic street address.

Arguments

None.

Example

{
    "company_address": "{{street_address}}"
}

# Example output

{
    "company_address": "5th avenue"
}

lorem(n)

Random text containing n words.

Arguments

n - How many words should text contain.

Example

{
    "description": "{{lorem(6)}}"
}

# Example output

{
    "description": "Find control party plan water prove safe."
}

empty

Empty value. Useful with combination with option placeholder.

Arguments

None.

Example

{
    "title": "{{empty}}"
}

# Example output

{
    "title": ""
}

range(prop,n,[m])

Generates property named prop with an array of values. The number of benefits depends on arguments n and m.

Note that range placeholder should be used at the left side of property. See examples below.

Arguments

  • prop - Name of property.

  • n - If only n specified array contains exactly n values.

  • optional m - If m is specified array contains items exactly between n up to m times.

Example

Generate exactly four people objects.

{
  "{{range(people,4)}}": {
    "name": "{{name}}",
    "age": "{{age}}",
    "address": {
      "city": "{{city}}"
    },
    "car": "{{option(mustang,{{empty}})}}"
  }
}

# Example output

{
    "people": [
        {
            "name": "Brandi Young",
            "age": 39,
            "address": {
                "city": "Jamietown"
            },
            "car": "mustang"
        },
        {
            "name": "Michelle Best",
            "age": 70,
            "address": {
                "city": "Port Dustin"
            },
            "car": ""
        },
        {
            "name": "Donald Hernandez",
            "age": 79,
            "address": {
                "city": "East Julieshire"
            },
            "car": "mustang"
        },
        {
            "name": "Kaitlyn Cook",
            "age": 3,
            "address": {
                "city": "Rachelton"
            },
            "car": "mustang"
        }
    ]
}

bool

Boolean value - true or false.

Arguments

None.

Example

{
    "awesome": "{{bool}}"
}

# Example output

{
    "awesome": "true"
}

option(arg1,arg2,…,argN)

Randomly choose one of the arguments (arg1,arg2,…,argN). This is very useful to generate more randomised data.

Arguments

Each argument can be an arbitrary value or even another placeholder.

Example

{
    "car": "{{option(mustang,{{empty}},C4)}}"
}

# Example output

{
    "car": "mustang"
}

# ... or for example

{
    "car": ""
}

Note

Missing some placeholder? JDOG can be easily extended.