{
"results" : [
{
"address_components" : [
{
"long_name" : "1600",
"short_name" : "1600",
"types" : [ "street_number" ]
},
{
"long_name" : "Amphitheatre Parkway",
"short_name" : "Amphitheatre Pkwy",
"types" : [ "route" ]
},
{
"long_name" : "Mountain View",
"short_name" : "Mountain View",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Santa Clara County",
"short_name" : "Santa Clara County",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "California",
"short_name" : "CA",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "United States",
"short_name" : "US",
"types" : [ "country", "political" ]
},
{
"long_name" : "94043",
"short_name" : "94043",
"types" : [ "postal_code" ]
}
],
"formatted_address" : "1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA",
"geometry" : {
"location" : {
"lat" : 37.4224484,
"lng" : -122.0843249
},
"location_type" : "ROOFTOP",
"viewport" : {
"northeast" : {
"lat" : 37.4237973802915,
"lng" : -122.0829759197085
},
"southwest" : {
"lat" : 37.4210994197085,
"lng" : -122.0856738802915
}
}
},
"place_id" : "ChIJ2eUgeAK6j4ARbn5u_wAGqWA",
"types" : [ "street_address" ]
}
],
"status" : "OK"
}
{cd2>和{cd2}如何从cd2}中检索。大多数json教程都是用简单的json文件解释的。 请在这方面帮助我,并帮助我找到一些好的教程
实际上,简单的json和复杂的json没有那么大的区别。可以说复杂JSON的内部有许多简单的JSON,所以如果您知道如何从简单的JSON中获取数据,那么您就知道如何从复杂的JSON中获取数据
总之,可以将JSON对象看作
dictionaries
,将JSON数组看作lists
。要从dict获取数据,请使用key
作为值。要从列表中获取数据,请使用值的index
(位置)。在所以,在你的情况下:
以及
^{pr2}$注意通过键的导航是如何发生的,以及在从键中检索值时是如何深入的
您可以从以下链接查看json库的文档:python2或python3 如果您有任何特殊的问题,您可以定义跟踪或代码部分来找到正确的答案。在
相关问题 更多 >
编程相关推荐