【发布时间】:2015-08-20 02:50:03
【问题描述】:
我将尝试解析 JSON 字符串,但解析 JSON 字符串中的“长”字符时出现问题。
JSON 代码如下
{ "valid": 1, "delta": 0, "time": 23755, "date": 200815, "fix": 2, "status": 1, "sats": 12, "lat": 37529922, "long": 126898053, "speed": 874, "heading": 0, "alt": 171300 }
我想获取 lat 和 long 值,但我无法获取值,因为 Long 字符是关键字
我的代码在下面
using (WebClient wc = new WebClient())
{
string json = wc.DownloadString(sb.ToString());
dynamic temp = JsonConvert.DeserializeObject(json);
Gps = new GpsInfo();
Gps.latY = temp.lat;
Gps.lonX = temp.long; //Error long type is keyword
SettingGpsChart(Gps);
}
如何解析 json 值 long 和 lat?
【问题讨论】:
-
广告:看看——我工作的公司也有搜索引擎bing.com/search?q=c%23+json+keyword(比你用的更好:))。