1、定义一个存储百度API返回json结果对象的类:
注:解析json字符串的方式有很多,无需局限于本文这一种。
public class baidu_location
{
[Serializable]
//存储百度定位API返回结果类
public class AddressForQueryIPFromBaidu {
public string Address { get; set; }
public Content Content { get; set; }
public string Status { get; set; }
}
[Serializable]
public class Content {
public string Address { get; set; }
public Address_Detail Address_Detail { get; set; }
public Point Point { get; set; }
}
[Serializable]
public class Address_Detail {
public string City { get; set; }
public string City_Code { get; set; }
public string District { get; set; }
public string Province { get; set; }
public string Street { get; set; }
public string Street_Number { get; se