Weight Object

Weight objects are used throughout ShipEngine Connect, such as for specifying the weight of a package.

Properties

This table lists the properties of a weight object and identifies those properties that are required. The nullable column indicates which properties may be null when the object is provided as an argument to one of your methods, and the required column indicates which properties are required when the object is returned from one of your methods

NameTypeRequired?Nullable?Description
valuenumber

The weight value for this package. This value may contain decimals.

unitstring

The unit of measure for this weight. Valid values include the following:

  • g - grams
  • oz - ounces
  • kg - kilograms
  • lb - pounds

Additional Convenience Properties

This table lists some additional convenience properties and methods that are included when a weight object is passed to one of your methods. None of these will ever be null.

NameTypeDescription
ouncesnumber

The weight value in ounces.

gramsnumber

The weight value in grams.

toOunces()

method

A method that returns a new weight object in ounces.

toGrams()

method

A method that returns a new weight object in grams.