address.address2

Generates realistic secondary address lines such as apartment numbers, suite numbers, unit designations, and floor numbers. Perfect for generating complete address data for testing, simulations, or mock data scenarios.

Keywords

prefixesoptional

An array of prefix strings to use for address line 2 generation. Each prefix must be a non-empty string. When not specified, defaults to: Apt, Apartment, Suite, Ste, Unit, #, Floor, Building, and Bldg.

minNumberoptional

The minimum unit number to generate (inclusive). Must be a positive integer greater than 0. When not specified, defaults to 1.

maxNumberoptional

The maximum unit number to generate (inclusive). Must be a positive integer greater than or equal to minNumber. When not specified, defaults to 999.

Behavior

Generated address line 2 values consist of two components:

  • Prefix: Randomly selected from the configured prefixes list
  • Unit designation: A number between minNumber and maxNumber, with a 40% chance of an uppercase letter suffix (A-Z)

Additional characteristics:

  • Values are not guaranteed to be unique
  • Generation is deterministic based on the simulation seed
  • Letter suffixes (when present) are always uppercase A-Z
  • Format follows standard US address line 2 conventions

Examples

Basic usage with defaults:

{
  "type": "address.address2"
}

Example outputs:

  • Apt 4B
  • Suite 205
  • Unit 12
  • Floor 3A
  • # 456
  • Building 7

Using custom prefixes for commercial buildings:

{
  "type": "address.address2",
  "prefixes": ["Suite", "Ste", "Floor"]
}

Example outputs:

  • Suite 123
  • Ste 45A
  • Floor 8

Generating high-rise apartment numbers:

{
  "type": "address.address2",
  "prefixes": ["Apt", "#"],
  "minNumber": 100,
  "maxNumber": 2500
}

Example outputs:

  • Apt 1205
  • # 847C
  • Apt 2341

In a complete address entity definition:

{
  "entities": {
    "customer": {
      "fields": {
        "name": {
          "type": "person.name"
        },
        "email": {
          "type": "internet.email"
        },
        "address1": {
          "type": "address.address1"
        },
        "address2": {
          "type": "address.address2"
        },
        "phone": {
          "type": "phone.number"
        }
      }
    }
  }
}

Notes

This schema generates secondary address line information (address line 2). It's designed to be used in combination with address.address1 for complete street addresses. Many addresses don't have a line 2, so you may want to make this field optional in your data models.

The 40% probability of letter suffixes (like "4B" or "12A") reflects real-world patterns where some buildings use letter designations while others use only numbers.

The generated values are fictional and suitable for testing and simulation purposes. They follow realistic patterns but are not real addresses.