Skip to content

Instantly share code, notes, and snippets.

@ssukhpinder
Created August 15, 2020 08:11
Show Gist options
  • Save ssukhpinder/3c0accf4e0d268774f380434cc61b9fa to your computer and use it in GitHub Desktop.
Save ssukhpinder/3c0accf4e0d268774f380434cc61b9fa to your computer and use it in GitHub Desktop.
public class LowerCaseResolver<T> : DefaultContractResolver
{
protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization)
{
JsonProperty property = base.CreateProperty(member, memberSerialization);
if (property.DeclaringType == typeof(T))
{
property.PropertyName = property.PropertyName.ToLower();
}
return property;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment