您可以使用参数和架构的 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"]],["最后更新时间 (UTC):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."]]