gpt4 book ai didi

java - Google Places API - 在 Android 端解码 Json

转载 作者:太空宇宙 更新时间:2023-11-04 12:23:29 24 4
gpt4 key购买 nike

我对处理 json 相当陌生,目前正在使用 Google Places API 来获取餐厅详细信息。我已经尝试通过以下文章对其进行解码,例如

但它没有用,因为就我的理解而言,我的 json 字符串非常复杂

我使用这个特定的函数通过 Volley API 获取 json

public String getVolleyURL() {
String query = null;
// query = SEARCH_QUERY + "&location=" + lat + "," + lon + "&radius=" + radius;
query = "&location=" + lat + "," +longg + "&radius=" + radius;

query = SEARCH_URL + query + "&key=" + GOOGLE_PLACE_KEY;
Log.wtf(TAG, "Volley_URL = " + query);
return query;
}

返回以下 Json 字符串

{
"html_attributions" : [],
"results" : [
{
"formatted_address" : "Metropolitan Life North Building, 11 Madison Ave, New York, NY 10010, Verenigde Staten",
"geometry" : {
"location" : {
"lat" : 40.74169,
"lng" : -73.9872068
},
"viewport" : {
"northeast" : {
"lat" : 40.74190884999999,
"lng" : -73.98716930000001
},
"southwest" : {
"lat" : 40.74161705,
"lng" : -73.98731529999999
}
}
},
"icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
"id" : "f758e0d7f68c659682afdb4b1c0749e7d3623839",
"name" : "Eleven Madison Park",
"opening_hours" : {
"open_now" : false,
"weekday_text" : []
},
"photos" : [
{
"height" : 1200,
"html_attributions" : [
"\u003ca href=\"https://maps.google.com/maps/contrib/102127816559576392189/photos\"\u003eTammy Liu\u003c/a\u003e"
],
"photo_reference" : "CoQBdwAAACwNCAsIpt6Li3P49bVZfSX8yDOA3QTsPsgc52jYRliBNBEqboYcE409Wf-ZYIae__HbKvaW1Xed-lnKjr0dus2Gbnn1Y8PTH_7HX89aiDo4lTASyuU8N7DxHndhiAXPqY-ZKozOzLcSYA7tP50_-caFILD36WpSQJIEWSPu3cgzEhCQ7c2ltmabHZsR88s-gc8kGhShA5LDudy3ZvcDAjalj9yn_KR7bw",
"width" : 1800
}
],
"place_id" : "ChIJEWbXz6ZZwokRLKmKrtPfVFY",
"price_level" : 4,
"rating" : 4.5,
"reference" : "CnRmAAAAWyhPb38cmZ765RA05cPPZkYqZbRGtDOOQi8d5yNuwCrvezX4liYo6DFNOdr8c-v2wwwnD9OqODteeO9oto9wNGI3F0ORvjKYCAwaNwGOMc2x8JYUljND4XmG41s0d44OXWxzloUQgRubjuFEDpTkhBIQAeucZk-7vCj6xP76Mkwt2RoUMaR7pkhrawYFttRUBIYellvYoJc",
"types" : [ "restaurant", "bar", "food", "point_of_interest", "establishment" ]
}
],
"status" : "OK"
}

任何形式的帮助将不胜感激!谢谢

最佳答案

你试过吗this ? JSON 是一种非常常见的标准格式,因此有大量的资源可用于与它们交互。 JSON的“规则”可见here .

关于java - Google Places API - 在 Android 端解码 Json,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38596431/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com