Skip to main content

Country Generator

Generates country-related data including names, codes, capitals, and currencies.

Basic Usage

{
"country": {"gen": "country"}
}

Output: Returns an object with all country fields.

Available Fields

FieldDescriptionExample
nameCountry nameUnited States
countryCode2-letter country codeUS
capitalCapital cityWashington D.C.
currencyCurrency nameUS Dollar
currencyCodeCurrency codeUSD

Options

This generator has no options.

Examples

Country Name

{
"country": {"gen": "country.name"}
}

Country Code

{
"code": {"gen": "country.countryCode"}
}

Capital City

{
"capital": {"gen": "country.capital"}
}

Currency

{
"currency": {"gen": "country.currency"},
"currencyCode": {"gen": "country.currencyCode"}
}

Common Patterns

International Addresses

{
"addresses": {
"count": 100,
"item": {
"id": {"gen": "uuid"},
"street": {"gen": "address.streetAddress"},
"city": {"gen": "address.city"},
"country": {"gen": "country.name"},
"countryCode": {"gen": "country.countryCode"}
}
}
}

Currency Exchange

{
"rates": {
"count": 50,
"item": {
"id": {"gen": "uuid"},
"fromCurrency": {"gen": "country.currencyCode"},
"toCurrency": {"gen": "country.currencyCode"},
"rate": {"gen": "float", "min": 0.1, "max": 10.0, "decimals": 4}
}
}
}

Travel Destinations

{
"destinations": {
"count": 30,
"item": {
"id": {"gen": "uuid"},
"country": {"gen": "country.name"},
"capital": {"gen": "country.capital"},
"description": {"gen": "lorem.paragraph"}
}
}
}

Next Steps