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.