我正在尝试获取google驾驶api返回的以下json对象的结果。
public class Step
{
List<Task> tasks;
public void AddTask(Task t)
{
t.StatusChanged += HandleStatusChanged;
}
private void HandleStatusChanged(object sender, TaskStatusEventArgs args)
{
string taskName = args.TaskName;
TaskStatus status = args.Status;
TripleLogic(taskName, status);
}
}
我将如何获取“text”或“end_address”中的数据
我试过了
EventHandler<TEventArgs>
和
"routes": [
{
"bounds": {
"Ga": {
"C": 39.01115,
"j": 39.06483
},
"xa": {
"j": -77.57857000000001,
"C": -77.47601
}
},
"copyrights": "Map data ©2015 Google",
"legs": [
{
"distance": {
"text": "9.4 mi",
"value": 15096
},
"duration": {
"text": "15 mins",
"value": 870
},
"end_address":"1234 Any St USA".....//and so on
我得到了
alert(result.routes.legs.distance.text)
和
alert(result.routes.legs.end_address);
分别
答案 0 :(得分:3)
routes
是一个数组,legs
是每个routes
数组对象中的数组
尝试
alert(routes[0].legs[0].distance.text)