Faker Reference for Mockarty
Table of Contents
- Overview
- Address
- DateTime
- Internet
- Text
- Payment
- Person
- Phone
- ID and Hashes
- Business
- Russian
- Common Types
- Math Functions
- Go Template Syntax
- Practical Examples
Overview
Faker in Mockarty generates random test data for dynamic mock responses. Every field listed below is a zero-argument accessor available through JPath as $.fake.FieldName.
{
"response": {
"payload": {
"id": "$.fake.UUID",
"name": "$.fake.FirstName",
"email": "$.fake.Email",
"createdAt": "$.fake.RFC3339"
}
}
}
Important: JPath mode does NOT support parameterized calls (
$.fake.UUIDis correct,$.fake.Number(1,100)is not) — with one exception:$.fake.IntBetween(min, max)returns a random integer in[min, max], e.g."qty": "$.fake.IntBetween(1, 100)". For arithmetic on values use Math Functions ($.increment,$.sum,$.multiply,$.subtract,$.divide,$.modulo).
Tip: One generated value in several places. Every
$.fake.*field generates a new value each time it is evaluated, and anextractrule cannot generate one (it only copies values from the request). If several response fields must carry the same value, take that value from the request and save it in a Mock Store, then reference it as$.mS.key:{ "extract": { "mStore": { "requestId": "$.req.requestId" } }, "response": { "payload": { "id": "$.mS.requestId", "link": "https://example.com/items/$.mS.requestId" } } }A counter kept in the Global Store with
$.increment($.gS.counter || 0)is another value you can use in more than one place.
Address
| Function | Description | Example |
|---|---|---|
$.fake.Latitude |
Random latitude | 81.12195 |
$.fake.Longitude |
Random longitude | -84.38158 |
$.fake.City |
City name | "New York" |
$.fake.Country |
Country name | "United States" |
$.fake.CountryCode |
ISO country code | "US" |
$.fake.State |
State or region of the generated address | "CA" |
$.fake.StreetAddress |
Street number and name | "4821 Maple Avenue" |
$.fake.ZipCode |
5-digit zip code | "07432" |
$.fake.Address |
Street line of the generated address (same value as StreetAddress) |
"4821 Maple Avenue" |
{
"response": {
"payload": {
"location": {
"address": "$.fake.Address",
"city": "$.fake.City",
"state": "$.fake.State",
"zip": "$.fake.ZipCode",
"country": "$.fake.Country",
"countryCode": "$.fake.CountryCode",
"coordinates": {
"lat": "$.fake.Latitude",
"lng": "$.fake.Longitude"
}
}
}
}
}
DateTime
| Function | Description | Example |
|---|---|---|
$.fake.UnixTime |
Unix timestamp (seconds) | 1197930901 |
$.fake.Date |
Random date (YYYY-MM-DD) | "1982-02-27" |
$.fake.TimeString |
Random time (HH:MM:SS) | "03:10:25" |
$.fake.MonthName |
Month name | "February" |
$.fake.YearString |
Year as string | "1994" |
$.fake.DayOfWeek |
Day of week name | "Sunday" |
$.fake.DayOfMonth |
Day of month | "20" |
$.fake.Timestamp |
Full timestamp (YYYY-MM-DD HH:MM:SS) | "1973-06-21 14:50:46" |
$.fake.RFC3339 |
Current time in RFC 3339 format | "2024-01-15T14:30:45Z" |
$.fake.Century |
Century (Roman numeral) | "IV" |
$.fake.Timezone |
Timezone identifier | "Asia/Jakarta" |
$.fake.TimePeriod |
AM or PM | "PM" |
{
"response": {
"payload": {
"createdAt": "$.fake.RFC3339",
"date": "$.fake.Date",
"time": "$.fake.TimeString",
"unixTs": "$.fake.UnixTime",
"month": "$.fake.MonthName",
"year": "$.fake.YearString",
"dayOfWeek": "$.fake.DayOfWeek",
"dayOfMonth": "$.fake.DayOfMonth",
"fullTimestamp": "$.fake.Timestamp",
"timezone": "$.fake.Timezone",
"period": "$.fake.TimePeriod"
}
}
}
Internet
| Function | Description | Example |
|---|---|---|
$.fake.Email |
Email address | "mJBJtbv@OSAaT.com" |
$.fake.MacAddress |
MAC address | "cd:65:e1:d4:76:c6" |
$.fake.DomainName |
Domain name | "FWZcaRE.org" |
$.fake.URL |
URL | "https://www.oEuqqAY.org/QgqfOhd" |
$.fake.Username |
Username | "lVxELHS" |
$.fake.IPv4 |
IPv4 address | "99.23.42.63" |
$.fake.IPv6 |
IPv6 address | "975c:fb2c:2133:fbdd:beda:282e:1e0a:ec7d" |
$.fake.Password |
Random password string | "dfJdyHGuVkHBgnHLQQgpINApynzexnRpgIKBpiIjpTP" |
$.fake.UserAgent |
Browser User-Agent string (one fixed value on every call) | "Mozilla/5.0 (Windows NT 10.0; Win64; x64) ..." |
$.fake.Color |
Color name (lower-case, from a fixed list) | "teal" |
$.fake.HexColor |
Hex color code | "#3a2f1c" |
{
"response": {
"payload": {
"contact": {
"email": "$.fake.Email",
"website": "$.fake.URL"
},
"technical": {
"ip": "$.fake.IPv4",
"ipv6": "$.fake.IPv6",
"mac": "$.fake.MacAddress",
"userAgent": "$.fake.UserAgent",
"domain": "$.fake.DomainName"
},
"style": {
"color": "$.fake.Color",
"hex": "$.fake.HexColor"
}
}
}
}
Text
| Function | Description | Example |
|---|---|---|
$.fake.Word |
Random word | "nesciunt" |
$.fake.Sentence |
Random sentence | "Consequatur perferendis voluptatem accusantium." |
$.fake.Paragraph |
Random paragraph (multiple sentences) | "Aut consequatur sit perferendis ..." |
$.fake.Letter |
Single lower-case letter (a-z) | "m" |
{
"response": {
"payload": {
"title": "$.fake.Sentence",
"description": "$.fake.Paragraph",
"keyword": "$.fake.Word",
"initial": "$.fake.Letter"
}
}
}
Payment
| Function | Description | Example |
|---|---|---|
$.fake.CCType |
Credit card type | "American Express" |
$.fake.CCNumber |
Credit card number | "373641309057568" |
$.fake.Currency |
Currency code | "USD" |
$.fake.AmountWithCurrency |
Amount with currency code | "USD 49257.100" |
$.fake.Price |
Price with two decimal places | "123.45" |
{
"response": {
"payload": {
"payment": {
"cardType": "$.fake.CCType",
"cardNumber": "$.fake.CCNumber",
"currency": "$.fake.Currency",
"total": "$.fake.AmountWithCurrency",
"price": "$.fake.Price"
}
}
}
}
Person
| Function | Description | Example |
|---|---|---|
$.fake.TitleMale |
Male title | "Mr." |
$.fake.TitleFemale |
Female title | "Mrs." |
$.fake.FirstName |
First name (any gender) | "Whitney" |
$.fake.FirstNameMale |
Male first name | "Kenny" |
$.fake.FirstNameFemale |
Female first name | "Jana" |
$.fake.LastName |
Last name | "Rohan" |
$.fake.Name |
Full name with title | "Mrs. Casandra Kiehn" |
$.fake.Gender |
Gender string | "Male" or "Female" |
{
"response": {
"payload": {
"user": {
"title": "$.fake.TitleMale",
"firstName": "$.fake.FirstName",
"lastName": "$.fake.LastName",
"fullName": "$.fake.Name",
"gender": "$.fake.Gender"
}
}
}
}
Phone
| Function | Description | Example |
|---|---|---|
$.fake.PhoneNumber |
Phone number | "201-886-0269" |
$.fake.Phone |
Alias for PhoneNumber |
"201-886-0269" |
$.fake.TollFreePhoneNumber |
Toll-free phone number | "(777) 831-964572" |
$.fake.E164PhoneNumber |
Phone in E.164 format | "+724891571063" |
{
"response": {
"payload": {
"contact": {
"phone": "$.fake.Phone",
"tollFree": "$.fake.TollFreePhoneNumber",
"international": "$.fake.E164PhoneNumber"
}
}
}
}
ID and Hashes
| Function | Description | Example |
|---|---|---|
$.fake.UUID |
UUID v4 with hyphens | "8f8e4463-9560-4a38-9b0c-ef24481e4e27" |
$.fake.UUIDDigit |
UUID without hyphens | "90ea6479fd0e4940af741f0a87596b73" |
$.fake.JWT |
Realistic JWT (header.payload.signature) | "eyJhbGciOiJIUzI1NiIs..." |
$.fake.MD5 |
MD5 hash (32 hex chars) | "5d41402abc4b2a76b9719d911017c592" |
$.fake.SHA256 |
SHA-256 hash (64 hex chars) | "e3b0c44298fc1c149afbf4c8996fb924..." |
{
"response": {
"payload": {
"id": "$.fake.UUID",
"shortId": "$.fake.UUIDDigit",
"token": "$.fake.JWT",
"checksum": "$.fake.MD5",
"hash": "$.fake.SHA256"
}
}
}
Business
| Function | Description | Example |
|---|---|---|
$.fake.Company |
Company name: a person name plus a legal suffix | "Whitney Inc." |
$.fake.JobTitle |
Job title | "Software Engineer" |
{
"response": {
"payload": {
"employee": {
"company": "$.fake.Company",
"jobTitle": "$.fake.JobTitle"
}
}
}
}
Russian
| Function | Description | Example |
|---|---|---|
$.fake.RussianFirstNameMale |
Russian male first name | "Александр" |
$.fake.RussianLastNameMale |
Russian male last name | "Иванов" |
$.fake.RussianFirstNameFemale |
Russian female first name | "Анна" |
$.fake.RussianLastNameFemale |
Russian female last name | "Иванова" |
{
"response": {
"payload": {
"russianUser": {
"firstName": "$.fake.RussianFirstNameMale",
"lastName": "$.fake.RussianLastNameMale"
},
"russianUserFemale": {
"firstName": "$.fake.RussianFirstNameFemale",
"lastName": "$.fake.RussianLastNameFemale"
}
}
}
}
Common Types
| Function | Description | Example |
|---|---|---|
$.fake.Bool |
Random boolean | true or false |
$.fake.String |
Random word (same as Word) | "lorem" |
$.fake.Number |
Random integer (0 to 999999) | 482731 |
$.fake.Int |
Random integer (0 to 999999) | 348217 |
$.fake.Float |
Random float (0 to 1000) | 472.839 |
$.fake.Digit |
Single digit (0-9) as string | "7" |
$.fake.PositiveInt |
Positive integer from 1 to 1,000,000 | 482731 |
$.fake.NegativeInt |
Negative integer from -1,000,000 to -1 | -482731 |
$.fake.Base64 |
Base64-encoded random bytes | "dGVzdCBiYXNlNjQ=" |
$.fake.Duration |
Duration string in seconds | "1842s" |
{
"response": {
"payload": {
"isActive": "$.fake.Bool",
"label": "$.fake.String",
"count": "$.fake.Number",
"score": "$.fake.Int",
"rate": "$.fake.Float",
"code": "$.fake.Digit",
"positiveId": "$.fake.PositiveInt",
"offset": "$.fake.NegativeInt",
"encoded": "$.fake.Base64",
"ttl": "$.fake.Duration"
}
}
}
Math Functions
These are NOT part of $.fake.* but are standalone JPath math expressions. They accept JPath expressions or literal numbers as arguments.
| Function | Description | Example |
|---|---|---|
$.increment(expr) |
Increment a numeric value by 1 | $.increment($.gS.counter) |
$.sum(a, b) |
Sum of two values | $.sum($.gS.price, 10) |
$.multiply(a, b) |
Product of two values | $.multiply($.gS.quantity, $.gS.unitPrice) |
$.subtract(a, b) |
Difference of two values | $.subtract($.gS.total, $.gS.discount) |
$.divide(a, b) |
Quotient of two values (a zero divisor yields 0) | $.divide($.gS.total, $.gS.count) |
$.modulo(a, b) |
Remainder of a / b | $.modulo($.gS.index, 2) |
Arguments can be:
- Literal numbers:
5,3.14 - JPath expressions:
$.gS.counter,$.cS.amount - Expressions with fallback:
$.gS.counter || 0(use 0 if the store key is missing)
{
"response": {
"payload": {
"nextId": "$.increment($.gS.lastId || 0)",
"total": "$.sum($.gS.subtotal, $.gS.tax)",
"extendedPrice": "$.multiply($.gS.quantity, $.gS.unitPrice)",
"balance": "$.subtract($.gS.credit, $.gS.debit)"
}
}
}
Standalone fallback
A || default fallback also works on its own — not only inside a math
function. When a field’s value is exactly $.ref || default, the reference is
used if it resolves, otherwise the literal default is returned. This gives a
field a graceful value when a store key or request field is absent:
{
"response": {
"payload": {
"greeting": "$.cS.userName || guest",
"currency": "$.req.currency || \"USD\"",
"retries": "$.gS.retryCount || 0"
}
}
}
If $.cS.userName is set the response echoes it; if not, it renders guest.
Wrap a multi-word or symbol default in double quotes (|| "N/A") — the quotes
are stripped. The same $.ref || default form works in XML response bodies.
Go Template Syntax
Go Template syntax applies to template files (a response whose payloadTemplatePath points at a file in the templates store). For an inline JSON response payload, use the default JPath syntax instead ($.fake.UUID, $.fake.FirstName, …) — the {{(fake).Method}} form below is rendered only by the file-template engine, so a {{(fake)…}} placed directly in an inline payload is returned verbatim.
In a .tmpl file, Faker is available via the fake function which returns a Faker object. Call zero-argument methods on it:
{
"id": "{{(fake).UUID}}",
"name": "{{(fake).FirstName}}",
"email": "{{(fake).Email}}",
"createdAt": "{{(fake).RFC3339}}"
}
The (fake) call returns a Faker struct, then .MethodName calls the corresponding method. For example:
{
"user": {
"id": "{{(fake).UUID}}",
"firstName": "{{(fake).FirstName}}",
"lastName": "{{(fake).LastName}}",
"phone": "{{(fake).PhoneNumber}}",
"isAdmin": {{(fake).Bool}},
"createdAt": "{{(fake).RFC3339}}"
}
}
Important: Not all JPath fields have Go Template methods. Only the methods listed in the table below are available in Go Template mode. JPath-only fields (like
City,Company,MD5,Phone,Price, etc.) are available only in JPath mode and are NOT callable via{{(fake).FieldName}}.
Available Go Template Methods
| Method | Return Type | Category |
|---|---|---|
{{(fake).Latitude}} |
float64 | Address |
{{(fake).Longitude}} |
float64 | Address |
{{(fake).GetRealAddress}} |
object | Address (Go Template only) |
{{(fake).UnixTime}} |
int64 | DateTime |
{{(fake).Date}} |
string | DateTime |
{{(fake).TimeString}} |
string | DateTime |
{{(fake).MonthName}} |
string | DateTime |
{{(fake).YearString}} |
string | DateTime |
{{(fake).DayOfWeek}} |
string | DateTime |
{{(fake).DayOfMonth}} |
string | DateTime |
{{(fake).Timestamp}} |
string | DateTime |
{{(fake).RFC3339}} |
string | DateTime |
{{(fake).Century}} |
string | DateTime |
{{(fake).Timezone}} |
string | DateTime |
{{(fake).TimePeriod}} |
string | DateTime |
{{(fake).Email}} |
string | Internet |
{{(fake).MacAddress}} |
string | Internet |
{{(fake).DomainName}} |
string | Internet |
{{(fake).URL}} |
string | Internet |
{{(fake).Username}} |
string | Internet |
{{(fake).IPv4}} |
string | Internet |
{{(fake).IPv6}} |
string | Internet |
{{(fake).Password}} |
string | Internet |
{{(fake).Word}} |
string | Text |
{{(fake).Sentence}} |
string | Text |
{{(fake).Paragraph}} |
string | Text |
{{(fake).CCType}} |
string | Payment |
{{(fake).CCNumber}} |
string | Payment |
{{(fake).Currency}} |
string | Payment |
{{(fake).AmountWithCurrency}} |
string | Payment |
{{(fake).TitleMale}} |
string | Person |
{{(fake).TitleFemale}} |
string | Person |
{{(fake).FirstName}} |
string | Person |
{{(fake).FirstNameMale}} |
string | Person |
{{(fake).FirstNameFemale}} |
string | Person |
{{(fake).LastName}} |
string | Person |
{{(fake).Name}} |
string | Person |
{{(fake).PhoneNumber}} |
string | Phone |
{{(fake).TollFreePhoneNumber}} |
string | Phone |
{{(fake).E164PhoneNumber}} |
string | Phone |
{{(fake).UUID}} |
string | ID |
{{(fake).UUIDDigit}} |
string | ID |
{{(fake).JWT}} |
string | ID |
{{(fake).Bool}} |
bool | Common |
{{(fake).String}} |
string | Common |
{{(fake).PositiveInt}} |
int64 | Common |
{{(fake).NegativeInt}} |
int64 | Common |
{{(fake).RussianFirstNameMale}} |
string | Russian |
{{(fake).RussianLastNameMale}} |
string | Russian |
{{(fake).RussianFirstNameFemale}} |
string | Russian |
{{(fake).RussianLastNameFemale}} |
string | Russian |
JPath-Only Fields (NOT Available in Go Template)
The following fields are available only via JPath $.fake.* and do NOT have corresponding Go Template methods:
City, Country, CountryCode, State, StreetAddress, ZipCode, Address, UserAgent, Color, HexColor, Letter, Digit, Gender, Phone, Number, Int, Float, Base64, Duration, Price, Company, JobTitle, MD5, SHA256
All listed fields are fully populated and return realistic values in JPath mode.
Go Template only:
GetRealAddress()returns a real address object with fieldsAddress,City,State, andPostalCode. This method is only available in Go Template mode via{{(fake).GetRealAddress}}– it is NOT accessible via JPath$.fake.GetRealAddress.{ "address": { "street": "{{(fake).GetRealAddress.Address}}", "city": "{{(fake).GetRealAddress.City}}", "state": "{{(fake).GetRealAddress.State}}", "zip": "{{(fake).GetRealAddress.PostalCode}}" } }
Practical Examples
Complete User Profile
{
"id": "user-profile",
"http": {
"route": "/api/users/profile"
},
"response": {
"payload": {
"user": {
"id": "$.fake.UUID",
"username": "$.fake.Username",
"firstName": "$.fake.FirstName",
"lastName": "$.fake.LastName",
"fullName": "$.fake.Name",
"gender": "$.fake.Gender",
"email": "$.fake.Email",
"phone": "$.fake.Phone",
"address": {
"street": "$.fake.StreetAddress",
"city": "$.fake.City",
"state": "$.fake.State",
"zip": "$.fake.ZipCode",
"country": "$.fake.Country",
"lat": "$.fake.Latitude",
"lng": "$.fake.Longitude"
},
"work": {
"company": "$.fake.Company",
"jobTitle": "$.fake.JobTitle"
},
"notifications": "$.fake.Bool",
"createdAt": "$.fake.RFC3339",
"ipAddress": "$.fake.IPv4",
"userAgent": "$.fake.UserAgent"
}
}
}
}
Financial Transaction
{
"id": "financial-transaction",
"http": {
"route": "/api/transactions"
},
"response": {
"payload": {
"transaction": {
"id": "$.fake.UUID",
"type": "payment",
"status": "completed",
"amount": "$.fake.Price",
"currency": "$.fake.Currency",
"total": "$.fake.AmountWithCurrency",
"card": {
"type": "$.fake.CCType",
"number": "$.fake.CCNumber"
},
"merchant": {
"name": "$.fake.Company",
"address": "$.fake.Address"
},
"customer": {
"name": "$.fake.Name",
"email": "$.fake.Email",
"phone": "$.fake.Phone"
},
"hash": "$.fake.SHA256",
"authCode": "$.fake.MD5",
"processedAt": "$.fake.RFC3339"
}
}
}
}
Complete Function List (Quick Reference)
All 74 zero-argument $.fake.* fields at a glance (plus the IntBetween(min, max) helper described above):
| # | Field | Category |
|---|---|---|
| 1 | Latitude |
Address |
| 2 | Longitude |
Address |
| 3 | City |
Address |
| 4 | Country |
Address |
| 5 | CountryCode |
Address |
| 6 | State |
Address |
| 7 | StreetAddress |
Address |
| 8 | ZipCode |
Address |
| 9 | Address |
Address |
| 10 | UnixTime |
DateTime |
| 11 | Date |
DateTime |
| 12 | TimeString |
DateTime |
| 13 | MonthName |
DateTime |
| 14 | YearString |
DateTime |
| 15 | DayOfWeek |
DateTime |
| 16 | DayOfMonth |
DateTime |
| 17 | Timestamp |
DateTime |
| 18 | RFC3339 |
DateTime |
| 19 | Century |
DateTime |
| 20 | Timezone |
DateTime |
| 21 | TimePeriod |
DateTime |
| 22 | Email |
Internet |
| 23 | MacAddress |
Internet |
| 24 | DomainName |
Internet |
| 25 | URL |
Internet |
| 26 | Username |
Internet |
| 27 | IPv4 |
Internet |
| 28 | IPv6 |
Internet |
| 29 | Password |
Internet |
| 30 | UserAgent |
Internet |
| 31 | Color |
Internet |
| 32 | HexColor |
Internet |
| 33 | Word |
Text |
| 34 | Sentence |
Text |
| 35 | Paragraph |
Text |
| 36 | Letter |
Text |
| 37 | CCType |
Payment |
| 38 | CCNumber |
Payment |
| 39 | Currency |
Payment |
| 40 | AmountWithCurrency |
Payment |
| 41 | Price |
Payment |
| 42 | TitleMale |
Person |
| 43 | TitleFemale |
Person |
| 44 | FirstName |
Person |
| 45 | FirstNameMale |
Person |
| 46 | FirstNameFemale |
Person |
| 47 | LastName |
Person |
| 48 | Name |
Person |
| 49 | Gender |
Person |
| 50 | PhoneNumber |
Phone |
| 51 | Phone |
Phone |
| 52 | TollFreePhoneNumber |
Phone |
| 53 | E164PhoneNumber |
Phone |
| 54 | UUID |
ID & Hashes |
| 55 | UUIDDigit |
ID & Hashes |
| 56 | JWT |
ID & Hashes |
| 57 | MD5 |
ID & Hashes |
| 58 | SHA256 |
ID & Hashes |
| 59 | Company |
Business |
| 60 | JobTitle |
Business |
| 61 | RussianFirstNameMale |
Russian |
| 62 | RussianLastNameMale |
Russian |
| 63 | RussianFirstNameFemale |
Russian |
| 64 | RussianLastNameFemale |
Russian |
| 65 | Bool |
Common |
| 66 | String |
Common |
| 67 | Number |
Common |
| 68 | Int |
Common |
| 69 | Float |
Common |
| 70 | Digit |
Common |
| 71 | PositiveInt |
Common |
| 72 | NegativeInt |
Common |
| 73 | Base64 |
Common |
| 74 | Duration |
Common |
See Also
- JsonPath Guide – query language used together with Faker for dynamic responses
- Store Systems – persist Faker-generated data across mock invocations
- API Reference – complete REST API for creating mocks with Faker
- Web UI Guide – create mocks with Faker visually in the Constructor
- Quick Start – get started with your first Faker-powered mock