1234567891011121314151617181920212223 |
- 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<T>(this string json)
- {
- return JsonConvert.DeserializeObject<T>(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 });
- }
- }
- }
|