24 lines
700 B
C#
24 lines
700 B
C#
using System.Reflection;
|
|
using Newtonsoft.Json;
|
|
using Newtonsoft.Json.Serialization;
|
|
|
|
namespace Knoks.Framework.Json
|
|
{
|
|
public class JsonPropertiesResolver : DefaultContractResolver
|
|
{
|
|
public JsonPropertiesResolver() : base()
|
|
{
|
|
NamingStrategy = new CamelCaseNamingStrategy();
|
|
}
|
|
|
|
protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization)
|
|
{
|
|
var property = base.CreateProperty(member, memberSerialization);
|
|
if(member.IsDefined(typeof(JsonIgnoreSerializeAttribute)))
|
|
property.ShouldSerialize = o => false;
|
|
|
|
return property;
|
|
}
|
|
}
|
|
}
|