地圖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; }