地图API返回经纬度:经度: 纬度:json
lng":114.03483089395202,"lat":22.615589046911805框架
decmail 接收数据后两位会截掉 系统框架默认取得是double类型 oop
解决方式是 进行设置 json.FloatParseHandling = FloatParseHandling.Decimal; setting.FloatParseHandling = FloatParseHandling.Decimal; 便可spa
/// <summary>
/// JSON对象反序列化 /// </summary>
/// <param name="JSON"></param>
/// <returns></returns>
public static T DeserializeObject<T>(string JSON) {
Newtonsoft.Json.JsonSerializer json = new Newtonsoft.Json.JsonSerializer(); json.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore; json.ObjectCreationHandling = Newtonsoft.Json.ObjectCreationHandling.Replace; json.MissingMemberHandling = Newtonsoft.Json.MissingMemberHandling.Ignore; json.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore; json.FloatParseHandling = FloatParseHandling.Decimal; json.DateFormatHandling = Newtonsoft.Json.DateFormatHandling.MicrosoftDateFormat; json.DateFormatString = "yyyy-MM-dd HH:mm:ss"; StringReader sr = new StringReader(JSON); Newtonsoft.Json.JsonTextReader reader = new JsonTextReader(sr); T result = (T)json.Deserialize(reader, typeof(T)); reader.Close(); return result; }