Lidarr/NzbDrone.Api/Extensions/Serializer.cs

33 lines
1.2 KiB
C#
Raw Normal View History

2013-02-23 20:35:26 +00:00
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
2013-02-23 20:35:26 +00:00
namespace NzbDrone.Api.Extensions
{
public static class Serializer
{
static Serializer()
{
Settings = new JsonSerializerSettings
{
DateTimeZoneHandling = DateTimeZoneHandling.Utc,
NullValueHandling = NullValueHandling.Ignore,
Formatting = Formatting.Indented,
DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate
};
Instance = new JsonSerializer
{
DateTimeZoneHandling = Settings.DateTimeZoneHandling,
NullValueHandling = NullValueHandling.Ignore,
Formatting = Formatting.Indented,
DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate,
ContractResolver = new CamelCasePropertyNamesContractResolver()
};
}
public static JsonSerializerSettings Settings { get; private set; }
public static JsonSerializer Instance { get; private set; }
}
}