它返回:
{
"destination_addresses" : [
"New York, NY 10011, USA",
"New York, NY 10012, USA",
"New York, NY 10013, USA"
],
"origin_addresses" : [ "New York, NY 10010, USA" ],
"rows" : [
{
"elements" : [
{
"distance" : {
"text" : "3.4 km",
"value" : 3389
},
"duration" : {
"text" : "19 mins",
"value" : 1156
},
"status" : "OK"
},
{
"distance" : {
"text" : "2.6 km",
"value" : 2632
},
"duration" : {
"text" : "13 mins",
"value" : 767
},
"status" : "OK"
},
{
"distance" : {
"text" : "9.5 km",
"value" : 9545
},
"duration" : {
"text" : "19 mins",
"value" : 1143
},
"status" : "OK"
}
]
}
],
"status" : "OK"
}
但我需要按距离排序数据。首先显示小而大。
有可能吗?
答案 0 :(得分:0)
当然! 1.将JSON数据解析为对象(JSON.parse); 2.使用如下代码对元素数组进行排序:
matplotlib.animation.FuncAnimation