解析如下的json格式数据:
HTTP response is:
<DirectionMatrixResponse>
<status>0</status>
<message>ok</message>
<info>
<copyright>
<text>@2015 Baidu - Data</text>
<imageUrl>http://api.map.baidu.com/images/
copyright_logo.png
</imageUrl>
</copyright>
</info>
<result>
<elements>
<distance>
<text>3.8??????</text>
<value>3772</value>
</distance>
<duration>
<text>7??????</text>
<value>392</value>
</duration>
<distance>
<text>10??????</text>
<value>10072</value>
</distance>
<duration>
<text>34??????</text>
<value>2015</value>
</duration>/elements>
</result>
</DirectionMatrixResponse>
请求格式如下:
//http://api.map.baidu.com/direction/v1/routematrixoutput=json
&//origins=origin1|orgin2&destinations=destination1|destination2&//
ak=E4805d16520de693a3fe707cdc962045
//origins=origin1|orgin2为请求的起点,destinations=destination1|destination2为请求的终点
try{
JObject jo1 = JObject.Parse(strResponse);
//将strResponce解析为JObject类
string result = jo1["result"].ToString();
JObject jo2 = JObject.Parse(result);
string elements= jo2["elements"].ToString();
}catch(Exception e)
{
Cons
}