проблема при разборе JSON с Google Places API - PullRequest
0 голосов
/ 03 апреля 2020

эй, я пытаюсь проанализировать данные json из http-запроса к google place api, и я столкнулся с несколькими проблемами: 1. как-то не все данные json анализируются, и я вижу только часть это когда я вставляю это в Журнал. 2. я получаю JSONException Value html_attributions of type java.lang.String cannot be converted to JSONObject

вот мой код синтаксического анализа:

var jsonString: String = ""
    GlobalScope.launch {
        var urlConnection: HttpURLConnection? = null
        val url = URL(url)
        urlConnection = url.openConnection() as HttpURLConnection
        urlConnection!!.requestMethod = "GET"
        urlConnection!!.readTimeout = 10000
        urlConnection!!.connectTimeout = 15000
        urlConnection!!.doOutput = true
        urlConnection!!.connect()

        val br = BufferedReader(InputStreamReader(url.openStream()))
        val sb = StringBuilder()
        var line: String

        while (  br.readLine()!= null ) {

            sb.append(br.readLine()+"\n")
        }

        br.close()
        jsonString = sb.toString()
        Log.d(TAG, "JSON: $jsonString")


    }

вот вывод json из URL:

``` {
   "html_attributions" : [],
   "next_page_token" : "CrQCKAEAADc4COHXhqbLGv6lGlu1pG1_QjA8ADcIenztd0R3xnZlAgXZn5lGUQOZGVXKyeNtlExCb8TlNu5utN9u2WxjKk806F7QPOLu6jxO-eNxlqV4W7bfUkkR0NvVTCnpREvcA_aBu1JQG3tsWens2dVCUmwdiqVRyw1Renexp19hnXQt_w-Nh8vjv-pcf1v_RAZXdYMaymG5QexBtGhMdDjdRZb39Y0aUCVPofwP257FRrSHfC16sZLTHs5U5gV469aI13--cG-Y_V-YRRCNcpFT2ErYrKdr6JBMPvojawF055YR0-cH57Y8JaeBH-EaSm_f8dbnzuKJHZOXr9tiR4DKZGkqJubgim5vXKsxYNgYb5fZBkHf1RdpIXnpqBCgMU09O7BGvOtlOSgNg8S_FzLsp2sSEJxZqXj_ZRCnSjXbzaFr6pkaFAOsSm3R4b5h0nDpRf7VCkVVo2OF",
   "results" : [
      {
         "formatted_address" : "3805 SE Washington Blvd, Bartlesville, OK 74006",
         "geometry" : {
            "location" : {
               "lat" : 36.7308333,
               "lng" : -95.93444439999999
            },
            "viewport" : {
               "northeast" : {
                  "lat" : 36.73217987989272,
                  "lng" : -95.93347037010727
               },
               "southwest" : {
                  "lat" : 36.72948022010728,
                  "lng" : -95.93617002989272
               }
            }
         },
         "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
         "id" : "abf92816b0f9eb5d8b4c6dea657f9abdf52d7d57",
         "name" : "Sushi-One",
         "opening_hours" : {
            "open_now" : true
         },
         "photos" : [
            {
               "height" : 5312,
               "html_attributions" : [
                  "\u003ca href=\"https://maps.google.com/maps/contrib/117699174184727661203\"\u003eAdam Gray\u003c/a\u003e"
               ],
               "photo_reference" : "CmRaAAAAh-vHnrE7CH5sRRZtpRi1MyXp-9umLVqFOBdwyLf27nGo_4yNFn5hkUOgroVRaWRXu_77fC2veZFFBSpDxSmQSaN7-UB2wpO1sW2NvY7mlLvMAodS4sEUFl_R2RPDg5kLEhCnqtqN4lUh-ABL9e06KEhXGhSgLjOap-hNCPI-OucbsGZzERi-CQ",
               "width" : 2988
            }
         ],
         "place_id" : "ChIJNTaa0aURt4cRO79zTXi1Qto",
         "plus_code" : {
            "compound_code" : "P3J8+86 ברטלסוויל, Oklahoma",
            "global_code" : "8686P3J8+86"
         },
         "price_level" : 2,
         "rating" : 4.5,
         "reference" : "ChIJNTaa0aURt4cRO79zTXi1Qto",
         "types" : [ "restaurant", "food", "point_of_interest", "establishment" ],
         "user_ratings_total" : 367
      },
      {
         "formatted_address" : "6560 E 51st St, Tulsa, OK 74145",
         "geometry" : {
            "location" : {
               "lat" : 36.08759570000001,
               "lng" : -95.9027155
            },
            "viewport" : {
               "northeast" : {
                  "lat" : 36.08894097989273,
                  "lng" : -95.90150602010728
               },
               "southwest" : {
                  "lat" : 36.08624132010728,
                  "lng" : -95.90420567989273
               }
            }
         },
         "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
         "id" : "50d41fd8db2aea7ee6a383e14f2c489b05ab8b99",
         "name" : "Yutaka Grill & Sushi Buffet",
         "opening_hours" : {
            "open_now" : true
         },
         "photos" : [
            {
               "height" : 3024,
               "html_attributions" : [
                  "\u003ca href=\"https://maps.google.com/maps/contrib/111271414295412345278\"\u003eQi Chen\u003c/a\u003e"
               ],
               "photo_reference" : "CmRaAAAAAzD6xy9vBeLCZL70bojCYsQr1u64KhhENPqChi5fC3RfVFYmVAX4eli8xfIDaqztXf1Hj0Kb9lIQQLabSSunZryE5qqhRJBiI4thvPqsMQNytm3ryXdUxkhVzlkCypgXEhBLauKzw7WbOyT9xcHTKmMDGhR3DSBiQKX18GCHd4x_J6Xuk35pbA",
               "width" : 4032
            }
         ],
         "place_id" : "ChIJ52WBsDyLtocRY621i-0WMnU",
         "plus_code" : {
            "compound_code" : "33QW+2W טולסה, Oklahoma",
            "global_code" : "868633QW+2W"
         },
         "rating" : 4.1,
         "reference" : "ChIJ52WBsDyLtocRY621i-0WMnU",
         "types" : [ "restaurant", "food", "point_of_interest", "establishment" ],
         "user_ratings_total" : 195
      },
      {
         "formatted_address" : "9205 E 71st St, Tulsa, OK 74133",
         "geometry" : {
            "location" : {
               "lat" : 36.061592,
               "lng" : -95.87319199999999
            },
            "viewport" : {
               "northeast" : {
                  "lat" : 36.06284667989271,
                  "lng" : -95.87178077010728
               },
               "southwest" : {
                  "lat" : 36.06014702010727,
                  "lng" : -95.87448042989273
               }
            }
         },
         "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
         "id" : "2f791d581ab15bba43b3d23a463fc15698892fbc",
         "name" : "Sake 2 Me Sushi",
         "opening_hours" : {
            "open_now" : true
         },
         "photos" : [
            {
               "height" : 3120,
               "html_attributions" : [
                  "\u003ca href=\"https://maps.google.com/maps/contrib/111690602218812971901\"\u003emandy shu\u003c/a\u003e"
               ],
               "photo_reference" : "CmRaAAAAanMSagj_5Cm1mJZ8JL103dLh9pGqLLodHFuEvHrnOabAMlghuWmKegO36Rmr0n_qod_yvBwj8anGF48JnCH6C1FzHVHEL7Q_0fyyMlJxECwD31AXPvFKzekdJf2u_CcVEhAZYrMiwKA8mMtMuSI_a_GVGhQ8dXV6t8xd1dZC7vq62XQJnW1urg",
               "width" : 4160
            }
         ],
         "place_id" : "ChIJSeCG1folTIYRjtp6WUqG6Yc",
         "plus_code" : {
            "compound_code" : "346G+JP טולסה, Oklahoma",
            "global_code" : "8686346G+JP"
         },
         "price_level" : 2,
         "rating" : 4.7,
         "reference" : "ChIJSeCG1folTIYRjtp6WUqG6Yc",
         "types" : [ "restaurant", "food", "point_of_interest", "establishment" ],
         "user_ratings_total" : 876
      },
      {
         "formatted_address" : "8065 E Peachtree Ln, Wichita, KS 67207",
         "geometry" : {
            "location" : {
               "lat" : 37.6803663,
               "lng" : -97.2433286
            },
            "viewport" : {
               "northeast" : {
                  "lat" : 37.68177402989271,
                  "lng" : -97.24197822010728
               },
               "southwest" : {
                  "lat" : 37.67907437010727,
                  "lng" : -97.24467787989273
               }
            }
         },
         "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
         "id" : "db23b8f4d8700f8252517c27eaaccdeb1a0bb3a9",
         "name" : "Sapporo japanese sushi restaurant",
         "opening_hours" : {
            "open_now" : false
         },
         "photos" : [
            {
               "height" : 3024,
               "html_attributions" : [
                  "\u003ca href=\"https://maps.google.com/maps/contrib/107470223809868805143\"\u003etroy Langhover\u003c/a\u003e"
               ],
               "photo_reference" : "CmRaAAAAmBBD3jsX3PcCUwYh79j6xCGaPyzPrp46p2bIZMi1iJUe3o0F-ReaWmw_20mX_U437V78-Fk24h37JFjQl5o5BhoKoZhKE853P1oAv6vqwT_mkqRGD3vz8gR_lAb8M9n9EhDL6K7vkhx2PHM2WCRTHZKEGhQfJvdj-dj_wfE8B5gow2CD5uMrDw",
               "width" : 4032
            }
         ],
         "place_id" : "ChIJdQaHnaL8uocRk3N1TQRLQzI",
         "plus_code" : {
            "compound_code" : "MQJ4+4M וויצ'יטה, Kansas",
            "global_code" : "8694MQJ4+4M"
         },
         "price_level" : 2,
         "rating" : 4.7,
         "reference" : "ChIJdQaHnaL8uocRk3N1TQRLQzI",
         "types" : [ "restaurant", "food", "point_of_interest", "establishment" ],
         "user_ratings_total" : 450
      },
      {
         "formatted_address" : "1415 W 8th St, Coffeyville, KS 67337",
         "geometry" : {
            "location" : {
               "lat" : 37.0359445,
               "lng" : -95.63959269999999
            },
            "viewport" : {
               "northeast" : {
                  "lat" : 37.03743777989272,
                  "lng" : -95.63824092010728
               },
               "southwest" : {
                  "lat" : 37.03473812010727,
                  "lng" : -95.64094057989271
               }
            }
         },
         "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
         "id" : "b701ec1726b4cae3ab424b6fc2e12db76cd60b5e",
         "name" : "Gen Hibachi",
         "opening_hours" : {
            "open_now" : true
         },
         "photos" : [
            {
               "height" : 960,
               "html_attributions" : [
                  "\u003ca href=\"https://maps.google.com/maps/contrib/103790775048605213217\"\u003eA Google User\u003c/a\u003e"
               ],
               "photo_reference" : "CmRaAAAAjnq6VI3FhPbdLqKULvRoFrtB7XvJPp8rMD-4iB4XqF_Cw4j8XWn_zApIOntbOvakB3PadCDgyRT6M0O3ZTiPHuFmb-BriH6hjgXWomWouIxxEXfacL7ShWf6Z6SwRAJpEhDC9rRGMf2hrC7Qw1muhug5GhRsTZajnKDQo0fZR-myu-5moGKYTA",
               "width" : 720
            }
         ],
         "place_id" : "ChIJzZTalbCFt4cR1szSJtfLjRg",
         "plus_code" : {
            "compound_code" : "29P6+95 Coffeyville, Parker, KS",
            "global_code" : "869629P6+95"
         },
         "rating" : 4.6,
         "reference" : "ChIJzZTalbCFt4cR1szSJtfLjRg",
         "types" : [ "restaurant", "food", "point_of_interest", "establishment" ],
         "user_ratings_total" : 45
      },

      {
         "formatted_address" : "6151 S Sheridan Rd, Tulsa, OK 74133",
         "geometry" : {
            "location" : {
               "lat" : 36.07368950000001,
               "lng" : -95.90332069999999
            },
            "viewport" : {
               "northeast" : {
                  "lat" : 36.07505102989272,
                  "lng" : -95.90246142010729
               },
               "southwest" : {
                  "lat" : 36.07235137010728,
                  "lng" : -95.90516107989272
               }
            }
         },
         "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
         "id" : "bd9e92fa0905be1c44f9ee449e648f1f26a97aac",
         "name" : "In the Raw",
         "opening_hours" : {
            "open_now" : true
         },
         "photos" : [
            {
               "height" : 598,
               "html_attributions" : [
                  "\u003ca href=\"https://maps.google.com/maps/contrib/113730469122923139550\"\u003eIn the Raw On the Hill\u003c/a\u003e"
               ],
               "photo_reference" : "CmRaAAAAHLVNjs8r5FJ0GwZ3JILjC1cPTBsaul3XckSixhPT2EFI2NQYGW7d_IQIQ0Q7_86dAxrS3nmgOx8DpuyYxAUs9FNC5YFHlAk3gFYXTnxB0Oc6FAn7YF4FVpsMciJGh8FrEhAJWZ7cqUzq5nBHLkJ23H6oGhRR3EgRPt0HCNgYVkYedfxvTV9LIQ",
               "width" : 900
            }
         ],
         "place_id" : "ChIJLV1L4H2StocR8rNRdduqwpM",
         "plus_code" : {
            "compound_code" : "33FW+FM טולסה, Oklahoma",
            "global_code" : "868633FW+FM"
         },
         "price_level" : 2,
         "rating" : 4.2,
         "reference" : "ChIJLV1L4H2StocR8rNRdduqwpM",
         "types" : [ "restaurant", "food", "point_of_interest", "establishment" ],
         "user_ratings_total" : 449
      },
      {
         "formatted_address" : "7831 E 71st St, Tulsa, OK 74133",
         "geometry" : {
            "location" : {
               "lat" : 36.0631558,
               "lng" : -95.8894562
            },
            "viewport" : {
               "northeast" : {
                  "lat" : 36.06447112989272,
                  "lng" : -95.88802382010728
               },
               "southwest" : {
                  "lat" : 36.06177147010728,
                  "lng" : -95.89072347989273
               }
            }
         },
         "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
         "id" : "17d0542bbade78742c0da1b33ef9eeefa78cee0f",
         "name" : "Asahi Sushi Bar",
         "opening_hours" : {
            "open_now" : true
         },
         "photos" : [
            {
               "height" : 2988,
               "html_attributions" : [
                  "\u003ca href=\"https://maps.google.com/maps/contrib/106008196393375297993\"\u003eTroy Horn\u003c/a\u003e"
               ],
               "photo_reference" : "CmRaAAAA0FXmMat9Kof8yzZBW_1tv5YwWKsoMRwZSkItj_jz6QQi1T8_SzB7r1g7hKowKmoottFIUgAQr7DPmOTr5jpoP8amFo7WInkZuEwz4c_2MXdjVT13CnTmxzjjMjaAKCZfEhClyDLOtMyBkddGwgYsDl1OGhRw2VaSjEDmteTqlIcOJvpHKMN9Jg",
               "width" : 3984
            }
         ],
         "place_id" : "ChIJP9DDOo6NtocRSAkdn9z7wN4",
         "plus_code" : {
            "compound_code" : "3476+76 טולסה, Oklahoma",
            "global_code" : "86863476+76"
         },
         "price_level" : 2,
         "rating" : 4.5,
         "reference" : "ChIJP9DDOo6NtocRSAkdn9z7wN4",
         "types" : [ "restaurant", "food", "point_of_interest", "establishment" ],
         "user_ratings_total" : 209
      },
      {
         "formatted_address" : "7820 E Harry St, Wichita, KS 67207",
         "geometry" : {
            "location" : {
               "lat" : 37.6650083,
               "lng" : -97.24598329999999
            },
            "viewport" : {
               "northeast" : {
                  "lat" : 37.66632052989272,
                  "lng" : -97.24464137010727
               },
               "southwest" : {
                  "lat" : 37.66362087010727,
                  "lng" : -97.24734102989271
               }
            }
         },
         "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
         "id" : "334e706aa23b22f0084f02f92ce06ba6873388e7",
         "name" : "Jacky Chan Sushi",
         "opening_hours" : {
            "open_now" : true
         },
         "photos" : [
            {
               "height" : 1536,
               "html_attributions" : [
                  "\u003ca href=\"https://maps.google.com/maps/contrib/108010994778213339330\"\u003eJacky Chan Sushi\u003c/a\u003e"
               ],
               "photo_reference" : "CmRaAAAAiDKCwY_JYv414cguPk1IJvY7lQa37Uq8UGxIlGJiL3D_kecbrErgXdWVp-FjNsGTnmOl4QnP8bwwGfDbZNOEG39mpxirJsUhLRUj9ZXdWgaF-0jGy_IQn1udf-h4KXK8EhB-NVPnLkhtyxkooeTc3cIFGhRj_V17Dat4Mm51f9ZVlylTAN1Kqw",
               "width" : 2048
            }
         ],
         "place_id" : "ChIJUfCJCznjuocReO15n4qOOro",
         "plus_code" : {
            "compound_code" : "MQ83+2J וויצ'יטה, Kansas",
            "global_code" : "8694MQ83+2J"
         },
         "price_level" : 2,
         "rating" : 4.2,
         "reference" : "ChIJUfCJCznjuocReO15n4qOOro",
         "types" : [ "restaurant", "food", "point_of_interest", "establishment" ],
         "user_ratings_total" : 324
      },
      {
         "formatted_address" : "3242 N Rock Rd #112, Wichita, KS 67226",
         "geometry" : {
            "location" : {
               "lat" : 37.741761,
               "lng" : -97.24323699999999
            },
            "viewport" : {
               "northeast" : {
                  "lat" : 37.74310762989272,
                  "lng" : -97.24202367010727
               },
               "southwest" : {
                  "lat" : 37.74040797010728,
                  "lng" : -97.24472332989272
               }
            }
         },
         "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
         "id" : "186ac1a08ad6a00da21600b00496665b4d44f3c2",
         "name" : "Wasabi Sushi Bar East",
         "opening_hours" : {
            "open_now" : true
         },
         "photos" : [
            {
               "height" : 1080,
               "html_attributions" : [
                  "\u003ca href=\"https://maps.google.com/maps/contrib/117587896898898944371\"\u003eimChanthip\u003c/a\u003e"
               ],
               "photo_reference" : "CmRaAAAAJ_VvjQCGFafBKAkGKv-95GrXQcE6g3xdVtnAJ5-EuvOC8IRJXjjtonSufsj2i3UjGmouuC4ODYQE6RNGxlGiRlvQrdttWllVRjbEd0TfkmSea0aZYj39y4E24Z3ldX_aEhAe3UrT28BmxPdr8nmucxW0GhS5PpTfmPcx2wsO9A4SqypMk8NnEw",
               "width" : 2076
            }
         ],
         "place_id" : "ChIJzZBewGn9uocRlNRWSd1BL30",
         "plus_code" : {
            "compound_code" : "PQR4+PP וויצ'יטה, Kansas",
            "global_code" : "8694PQR4+PP"
         },
         "price_level" : 2,
         "rating" : 4.5,
         "reference" : "ChIJzZBewGn9uocRlNRWSd1BL30",
         "types" : [ "bar", "restaurant", "food", "point_of_interest", "establishment" ],
         "user_ratings_total" : 690
      },
      {
         "formatted_address" : "8115 S Olympia Ave W #120, Tulsa, OK 74132",
         "geometry" : {
            "location" : {
               "lat" : 36.0460916,
               "lng" : -96.00364880000001
            },
            "viewport" : {
               "northeast" : {
                  "lat" : 36.04765097989272,
                  "lng" : -96.00236102010729
               },
               "southwest" : {
                  "lat" : 36.04495132010727,
                  "lng" : -96.00506067989272
               }
            }
         },
         "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
         "id" : "baf873fdc5c7f89b1277d3e5fb91d02f23caa6ac",
         "name" : "SushiFork of Tulsa",
         "opening_hours" : {
            "open_now" : true
         },
         "photos" : [
            {
               "height" : 1920,
               "html_attributions" : [
                  "\u003ca href=\"https://maps.google.com/maps/contrib/115238280658809384326\"\u003eNoahdet\u003c/a\u003e"
               ],
               "photo_reference" : "CmRaAAAA3X9nFCn0CfO6BgQLSaGgh6CVm3OZbYGW2g4oOvT_jwM4KglOEJrXKtjesgSxrAnflXC6Uc2Bue_ckcb7pOBAC-4r-_SRj3EYRqG0xIUPz4p1Ixv2CUGlgUIiYTwObg5ZEhCjUCk0SzGuW8gkyIU_70jsGhTxJdqq7CDq3UCbNbWfuz0HQRSlBg",
               "width" : 1080
            }
         ],
         "place_id" : "ChIJa--KbhWUtocRJ8DbZtDaQOs",
         "plus_code" : {
            "compound_code" : "2XWW+CG טולסה, Oklahoma",
            "global_code" : "86852XWW+CG"
         },
         "price_level" : 2,
         "rating" : 4.8,
         "reference" : "ChIJa--KbhWUtocRJ8DbZtDaQOs",
         "types" : [ "restaurant", "food", "point_of_interest", "establishment" ],
         "user_ratings_total" : 1288
      }
   ],
   "status" : "OK"
}```

и вот мой logcat:

JSON:    "html_attributions" : [],
       "results" : [
             "formatted_address" : "309 E 2nd St, Tulsa, OK 74120",
                "location" : {
                   "lng" : -95.9879217
                "viewport" : {
                      "lat" : 36.15712832989272,
                   },
                      "lat" : 36.15442867010727,
                   }
             },
             "id" : "417b86783a1251977e69031c6a6b2e6836e8b64d",
             "opening_hours" : {
             },
                {
                   "html_attributions" : [
                   ],
                   "width" : 4128
             ],
             "plus_code" : {
                "global_code" : "86865246+8R"
             "price_level" : 2,
             "reference" : "ChIJPYITSH_rtocRgVXRW-PpEZM",
             "user_ratings_total" : 1352
          {
             "geometry" : {
                   "lat" : 37.2235351,
                },
                   "northeast" : {
                      "lng" : -95.72866747010727
                   "southwest" : {
                      "lng" : -95.73136712989272
                }
             "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
             "name" : "Saiko Hibachi",
                "open_now" : true
             "photos" : [
                   "height" : 3024,
                      "\u003ca href=\"https://maps.google.com/maps/contrib/115218968412360523387\"\u003eCallie Hagood\u003c/a\u003e"
                   "photo_reference" : "CmRaAAAAKvohaq-DR4eB6-aBScOk0UQMkJHTiNwHUPfw5syYOJe6eInSOy253kYLKxLxbB7IelkDeSNa45gXQnXDc1sCv5KRy0iOC1JN_DKUx_owUfkN4V1OjFNHNW__bb8Kw4RtEhAefEv7beQBzJHDVzFoRrl4GhRfNbdugxokGmEFRtxjJ-FWnKd8JA",
                }
             "place_id" : "ChIJQ-EPAL8ruIcRvzaqNDK-RRI",
                "compound_code" : "67FC+C2 Independence, KS",
             },
             "reference" : "ChIJQ-EPAL8ruIcRvzaqNDK-RRI",
             "user_ratings_total" : 24
          {
             "geometry" : {
                   "lat" : 39.016134,
                },
                   "northeast" : {
                      "lng" : -94.72612597010729
                   "southwest" : {
                      "lng" : -94.72882562989273
                }
             "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
             "name" : "Oishi Sushi Restaurant & Bar",
                "open_now" : false
             "photos" : [
                   "height" : 3024,
                      "\u003ca href=\"https://maps.google.com/maps/contrib/101450306497961907418\"\u003eXQSlink\u003c/a\u003e"
                   "photo_reference" : "CmRaAAAAvvUnVdXHUEZ18a3lhM-oYrOWvkdGfot4sPr-r3AjmBlRP00iXUMNfb0wjzrHq07q5YkmxIa8rrfe8qXcpakO9Akz--BlUgot6N3WRLuiRrqhDB4ozaCkqoqk0JXdF0rSEhAOirGPSRjAe2T-xfrAodi7GhQTKP1H7ALtVlRLXBvutt2lv0s-Ow",
                }
             "place_id" : "ChIJwXiJS9XswIcRg8PCxdRsaWw",
                "compound_code" : "278F+F2 Shawnee, Shawnee Mission, KS",
             },
             "rating" : 4.6,
             "types" : [ "restaurant", "food", "point_of_interest", "establishment" ],
          },
             "formatted_address" : "1724 W Main St, Independence, KS 67301",
                "location" : {
                   "lng" : -95.7287063
                "viewport" : {
                      "lat" : 37.22498977989272,
                   },
                      "lat" : 37.22229012010727,
                   }
             },
             "id" : "5b26228c5dfa1b4e65f8d32c1ff1e9f416cfdfe9",
             "opening_hours" : {
             },
                {
                   "html_attributions" : [
                   ],
                   "width" : 4032
             ],
             "plus_code" : {
                "global_code" : "869667FC+GG"
             "price_level" : 2,
             "reference" : "ChIJj4FXg0oruIcR0OuOewzefME",
             "user_ratings_total" : 471
          {
             "geometry" : {
                   "lat" : 38.9171841,
                },
                   "northeast" : {
                      "lng" : -94.64656997010728
                   "southwest" : {
                      "lng" : -94.64926962989273
                }
             "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
             "name" : "RA Sushi Bar Restaurant",
                "open_now" : true
             "photos" : [
                   "height" : 3024,
                      "
2020-04-02 23:52:18.647 4860-4949/com.example.burgertracker E/AndroidRuntime: FATAL EXCEPTION: DefaultDispatcher-worker-1
    Process: com.example.burgertracker, PID: 4860
    org.json.JSONException: Value html_attributions of type java.lang.String cannot be converted to JSONObject
        at org.json.JSON.typeMismatch(JSON.java:112)
        at org.json.JSONObject.<init>(JSONObject.java:168)
        at org.json.JSONObject.<init>(JSONObject.java:181)
        at com.example.burgertracker.MapSearcher$getJSONFromUrl$1.invokeSuspend(MapSearcher.kt:47)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:241)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:594)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.access$runSafely(CoroutineScheduler.kt:60)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:740) 

* я вырезал некоторые части из вывода json, потому что он был слишком длинным, так что вы можете видеть, что только часть JSON анализируется, когда я печатаю jsonString в журнале и получаю эти исключения ... есть идеи? спасибо

...