Type and format

  • Thetype andformat properties are used to determine the data type of properties in JSON requests and responses.

  • Thetype property indicates the JSON data type, while theformat property provides additional, more specific type information.

  • Some data types that cannot be directly represented in JSON, like 64-bit integers, are represented as astringtype with a specificformat value.

  • The Google APIs Discovery Service supports a list oftype andformat values, including those defined in the JSON Schema spec and some Google-specific ones.

Thetype andformat properties on parameters and schemas can be used to determine the data type of the property. Thetype property indicates the type of the property when its sent in JSON requests and responses (JSON supports a small set of data types, seejson.org for details). Theformat property provides additional information about the underlying type. Properties will always have atype property, but some may also have aformat property.

For example, a 64-bit integer cannot be represented in JSON (since JavaScript and JSON support integers up to 2^53). Therefore, a 64-bit integer must be represented as a string in JSON requests/responses. So thetype property will be set to "string", but theformat property will be set to "int64" to indicate that it is a 64-bit integer.

The JSON Schema spec alreadydefines a set of common values for theformat property. The Google APIs Discovery Service supports some of these values, and defines others as well. The full list oftype andformat values supported by Google APIs Discovery Service is summarized below.

Note: Theclient libraries that we automatically generate from an API's discovery document sometimes use language-idiomatic types for these types and formats. For example: A 64-bit integer is represented as typestring in JSON requests and responses, but our generated Java client library uses the Javalong type.
Type valueFormat valueMeaning
any The property may have any type. Defined by theJSON Schema spec.
anygoogle.protobuf.Value The property has the JSON representation of the type ofgoogle.protobuf.Value.
array A JavaScript array of values. Theitems property indicates the schema for the array values. Defined by the JSON Schema spec.
arraygoogle.protobuf.ListValue The property has the JSON representation of the type ofgoogle.protobuf.ListValue.
booleanA boolean value, either "true" or "false". Defined by the JSON Schema spec.
integerint32 A 32-bit signed integer. It has a minimum value of -2,147,483,648 and a maximum value of 2,147,483,647 (inclusive).
integeruint32 A 32-bit unsigned integer. It has a minimum value of 0 and a maximum value of 4,294,967,295 (inclusive).
numberdoubleA double-precision 64-bit IEEE 754 floating point.
numberfloatA single-precision 32-bit IEEE 754 floating point.
objectA JavaScript object. Defined by the JSON Schema spec.
objectgoogle.protobuf.Struct The property has the JSON representation of the type ofgoogle.protobuf.Struct.
objectgoogle.protobuf.Any The property has the JSON representation of the type ofgoogle.protobuf.Any.
stringAn arbitrary string. Defined by the JSON Schema spec.
stringbyte A padded, base64-encoded string of bytes, encoded with a URL and filename safe alphabet (sometimes referred to as "web-safe" or "base64url"). Defined byRFC4648.
stringdateAn RFC3339 date in the format YYYY-MM-DD. Defined in the JSON Schema spec.
stringdate-time An RFC3339 timestamp in UTC time. This in the format of yyyy-MM-ddTHH:mm:ss.SSSZ. The milliseconds portion (".SSS") is optional. Defined in the JSON Schema spec.
stringgoogle-datetime An RFC3339 timestamp in UTC time. This in the format of yyyy-MM-ddTHH:mm:ss.SSSZ. The milliseconds portion (".SSS") is optional.
stringgoogle-duration A string ends in the suffix "s" (indicating seconds) and is preceded by the number of seconds, with nanoseconds expressed as fractional seconds. The period is always used as the decimal point, not a comma.
stringgoogle-fieldmask A string where field names are separated by a comma. Field names are represented in lower-camel naming conventions.
stringint64 A 64-bit signed integer. It has a minimum value of -9,223,372,036,854,775,808 and a maximum value of 9,223,372,036,854,775,807 (inclusive).
stringuint64 A 64-bit unsigned integer. It has a minimum value of 0 and a maximum value of (2^64)-1 (inclusive).

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-04-14 UTC.