您可以使用參數和結構定義的 type 和 format 屬性,判斷屬性的資料類型。type 屬性會在 JSON 要求和回應中傳送時,指出屬性類型 (JSON 支援少量資料類型,詳情請參閱 json.org)。format 屬性會提供基礎類型的其他資訊。資源一律都會有 type 屬性,但有些資源也可能會有 format 屬性。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-29 (世界標準時間)。"],[[["\u003cp\u003eThe \u003ccode\u003etype\u003c/code\u003e property in parameters and schemas indicates the data type as represented in JSON requests and responses.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eformat\u003c/code\u003e property provides further detail about the underlying data type, complementing the \u003ccode\u003etype\u003c/code\u003e property.\u003c/p\u003e\n"],["\u003cp\u003eCertain data types, like 64-bit integers, are represented as strings in JSON, where \u003ccode\u003etype\u003c/code\u003e is "string" and \u003ccode\u003eformat\u003c/code\u003e is "int64".\u003c/p\u003e\n"],["\u003cp\u003eThe Google APIs Discovery Service supports several \u003ccode\u003eformat\u003c/code\u003e values, some defined by the JSON Schema specification and others specifically by Google.\u003c/p\u003e\n"],["\u003cp\u003eThe client libraries may use language-specific types, rather than the type and format values present in the JSON, such as representing a 64-bit integer with a type \u003ccode\u003elong\u003c/code\u003e in Java, instead of a string.\u003c/p\u003e\n"]]],[],null,["# Type and format\n\nThe `type` and `format` properties on parameters and schemas can be used\nto determine the data type of the property. The `type` property indicates the type of\nthe property when its sent in JSON requests and responses (JSON supports a small set of data\ntypes, see [json.org](https://json.org) for details). The `format`\nproperty provides additional information about the underlying type. Properties will always have\na `type` property, but some may also have a `format` property.\n\n\nFor example, a 64-bit integer cannot be represented in JSON (since JavaScript and JSON support\nintegers up to 2\\^53). Therefore, a 64-bit integer must be represented as a string in JSON\nrequests/responses. So the `type` property will be set to \"string\", but the\n`format` property will be set to \"int64\" to indicate that it is a 64-bit integer.\n\n\nThe JSON Schema spec already [defines a set of common\nvalues](https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.23) for the `format` property. The Google APIs Discovery Service supports some\nof these values, and defines others as well. The full list of `type` and\n`format` values supported by Google APIs Discovery Service is summarized below.\n| **Note:** The [client libraries](https://developers.google.com/api-client-library/) 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 type `string` in JSON requests and responses, but our generated Java client library uses the Java `long` type."]]