Basic Data Types

boolean

JSON supports the boolean type, which consists of the literal strings:

  • true
  • false

Example

{
    "trueValue": true,
    "falseValue": false
}

Color

Color is expressed using hexadecimal triplets representing the colors red, green, and blue (#RRGGBB). Some example colors include:

  • Red: #FF0000
  • Green: #00FF00
  • Blue: #0000FF
  • Black: #000000
  • White: #FFFFFF

Date

JSON does not have a data type for Date. The API uses the string representation of date in the form "yyyy-M-d" where:

  • yyyy: 4 digit year.
  • M: integer month where first month of the year is 1 and the last month is 12.
  • d: integer day, valid values are 1 to 31.
{
    "newYear2012": "2012-1-1",
    "christmas2011": "2011-12-25"
}

Distance

Parameter Type
value decimal The numeric component of the distance.
unit DistanceUnit The distance's unit.

Example

{
    "100meters":
    {
        "value": 100,
        "unit": "m"
    },
    "10k":
    {
        "value": 10,
        "unit": "km"
    },
    "marathon":
    {
        "value": 26.2,
        "unit": "mi"
    }
}

DistanceUnit

Unit Type Value
Kilometer string km
Mile string mi
Meter string m
Yard string yd

Gender

Unit Type Value
Female string f
Male string m

FootwearSize

Parameter Type
value decimal The numeric component.
unit FootwearSizeUnit The equipment's size unit

FootwearSizeUnit

Unit Type Value
United States string us
United Kingdom string uk
Europe string eu
Australia string au
Japan string jp

Money

Parameter Type
value decimal The numeric component.
unit 3-letter ISO 4217 currency code Please consult the full list for the appropriate code.

Temperature

Parameter Type
value decimal The numeric component of the temperature.
unit TemperatureUnit The temperature's unit.

Example

{
    "freezingPointC":
    {
        "value": 0,
        "unit": "C"
    },
    "freezingPointF":
    {
        "value": 32,
        "unit": "F"
    },
    "boilingPoint":
    {
        "value: 100,
        "unit": "C"
    }
}

TemperatureUnit

Unit Type Value
Celsius string C
Fahrenheit string F

Time

JSON does not have a data type for time. The API uses the string representation of time in the form "HH:mm:ss" where:

  • H: integer hour in 24-hour format, where 3 represents 3 AM and 15 represents 3 PM.
  • mm: 2 digit minutes.
  • ss: 2 digit seconds.

Example

{
    "midnight": "0:00:00",
    "noon": "12:00:00",
    "sixThirtyPM": "18:30:00"
}

Weight

Parameter Type
value decimal The numeric component of the weight.
unit WeightUnit The weight's unit.

Example

{
    "1kg":
    {
        "value": 1,
        "unit": "kg"
    },
    "150lb":
    {
        "value": 150
        "unit": "lb"
    }
}

WeightUnit

Unit Type Value
Kilogram string kg
Pound string lb