Google 地图地理编码返回的最大长度 json 数据

max lengths json data returned by Google Maps geocoding

我正在使用 ubilabs 的地理编码插件在移动应用程序中获取自动地址建议。

有谁知道我在哪里可以找到不同 JSON 元素的最大长度 Google returns?

给定以下JSON,以下字段的最大长度是多少:


{

    "html_attributions" : [],

    "result" : {

      "address_components" : [

         {
            "long_name" : "48",
            "short_name" : "48",
            "types" : [ "street_number" ]
         },
         {
            "long_name" : "Pirrama Road",
            "short_name" : "Pirrama Road",
            "types" : [ "route" ]
         },
         {
            "long_name" : "Pyrmont",
            "short_name" : "Pyrmont",
            "types" : [ "locality", "political" ]
         },
         {
            "long_name" : "NSW",
            "short_name" : "NSW",
            "types" : [ "administrative_area_level_1", "political" ]
         },
         {
            "long_name" : "AU",
            "short_name" : "AU",
            "types" : [ "country", "political" ]
         },
         {
            "long_name" : "2009",
            "short_name" : "2009",
            "types" : [ "postal_code" ]
         }
      ],
      "formatted_address" : "48 Pirrama Road, Pyrmont NSW, Australia",
      "formatted_phone_number" : "(02) 9374 4000",
      "geometry" : {
         "location" : {
           "lat" : -33.8669710,
           "lng" : 151.1958750
         }
      },


      "icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png",
      "id" : "4f89212bf76dde31f092cfc14d7506555d85b5c7",
      "international_phone_number" : "+61 2 9374 4000",
      "name" : "Google Sydney",
      "place_id" : "ChIJN1t_tDeuEmsRUsoyG83frY4",
      "scope" : "GOOGLE",
      "alt_ids" : [
         {
            "place_id" : "D9iJyWEHuEmuEmsRm9hTkapTCrk",
            "scope" : "APP"
         }
      ],
      "rating" : 4.70,
      "reference" : "CnRsAAAA98C4wD-VFvzGq-KHVEFhlHuy1TD1W6UYZw7KjuvfVsKMRZkbCVBVDxXFOOCM108n9PuJMJxeAxix3WB6B16c1p2bY1ZQyOrcu1d9247xQhUmPgYjN37JMo5QBsWipTsnoIZA9yAzA-0pnxFM6yAcDhIQbU0z05f3xD3m9NQnhEDjvBoUw-BdcocVpXzKFcnMXUpf-nkyF1w",
      "reviews" : [
         {
            "aspects" : [
               {
                  "rating" : 3,
                  "type" : "quality"
               }
            ],
            "author_name" : "Simon Bengtsson",
            "author_url" : "https://plus.google.com/104675092887960962573",
            "language" : "en",
            "rating" : 5,
            "text" : "Just went inside to have a look at Google. Amazing.",
            "time" : 1338440552869
         },
         {
           "aspects" : [
              {
                 "rating" : 3,
                 "type" : "quality"
              }
             ],
            "author_name" : "Felix Rauch Valenti",
            "author_url" : "https://plus.google.com/103291556674373289857",
            "language" : "en",
            "rating" : 5,
            "text" : "Best place to work :-)",
            "time" : 1338411244325
         },
         {
           "aspects" : [
              {
                 "rating" : 3,
                 "type" : "quality"
              }
             ],
            "author_name" : "Chris",
            "language" : "en",
            "rating" : 5,
            "text" : "Great place to work, always lots of free food!",
            "time" : 1330467089039
         }
      ],
      "types" : [ "establishment" ],
      "url" : "http://maps.google.com/maps/place?cid=10281119596374313554",
      "vicinity" : "48 Pirrama Road, Pyrmont",
      "website" : "http://www.google.com.au/"
    },
    "status" : "OK"
    }

这是我对 JavaScript 有疑问的地方。变量定义模糊。因此,如果您的对象包含一个字符串元素,那么它将是字符串变量的限制。

我发现here,这是:

In JScript, variant string variables have the same limit as in VBScript, up to 2^31 characters.

String literals (as in "this is a literal") have (IIRC) a limit ~2^10 (1024) characters.

我的理解是这将是特定于浏览器的。 Internet Explorer 将不同于 FireFox;这将与 Safari 不同......等等。那么有限制吗?我怀疑不是。 String 变量可能只是一个 Char 数组。如果是这种情况,它很可能没有限制,并且可以增长到网络浏览器可用的任何内存级别。

那么数组的极限是多少?发现 this article 说:

the maximum length of an array according to the ECMA-262 5th Edition specification is bound by an unsigned 32-bit integer due to the ToUint32 abstract operation, so the longest possible array could have 232-1 = 4,294,967,295 = 4.29 billion elements.

这表明 String 变量可能达到 42.9 亿个字符。 Integer、Float、Double……不同的野兽。

回到你的问题,以下字段的最大长度是多少,我建议你参考this

JSON is similar to other data formats like XML - if you need to transmit more data, you just send more data. There's no inherent size limitation to the overall JSON request itself. Any limitation would be set by the server parsing the JSON request. (For instance, ASP.NET has the "MaxJsonLength" property of the serializer.)

归功于 Amber