using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Web.Script.Serialization; using Newtonsoft.Json; using System.IO; namespace Bowin.Common.JSON { public static class ConvertJsonToObject { public static T JsonToObject(this string json) { return JsonConvert.DeserializeObject(json, new JsonSerializerSettings { DateTimeZoneHandling = DateTimeZoneHandling.Local, NullValueHandling = NullValueHandling.Ignore, MissingMemberHandling = MissingMemberHandling.Ignore }); } public static string ToJson(this object obj) { return JsonConvert.SerializeObject(obj, new JsonSerializerSettings { DateTimeZoneHandling = DateTimeZoneHandling.Local, NullValueHandling = NullValueHandling.Ignore, MissingMemberHandling = MissingMemberHandling.Ignore }); } } }