日期:2014-05-17 浏览次数:21147 次
var json = eval(data);
var status= json.status;
var result= json.result;
var lng= result.result;
class Program
{
static void Main(string[] args)
{
string json = "{'status':0,'result':{'location':{'lng':107.49497344659,'lat':31.214198858945},'precise':0,'confidence':10,'level':'\u57ce\u5e02'}}";
Data data = JsonConvert.DeserializeObject<Data>(json);
Console.WriteLine(data.result.location.lat);//输出 31.214198858945
}
}
public class Data
{
public int status { get; set; }
public Result result { get; set; }
}
public class Result
{
public Location location { get; set; }
public int precise { get; set; }
public int confidence { get; set; }
public string level { get; set; }
}
public class Location
{
public double lng { get; set; }
public double lat { get; set; }
}