The T:Newtonsoft.Json.Serialization.IContractResolver interface provides a way to customize how the JsonSerializer serializes and deserializes .NET objects to JSON without placing attributes on your classes.

Anything that can be set on an object, collection, property, etc, using attributes or methods to control serialization can also be set using an IContractResolver.

# DefaultContractResolver

The T:Newtonsoft.Json.Serialization.DefaultContractResolver is the default resolver used by the serializer. It provides many avenues of extensibility in the form of virtual methods that can be overriden.

# CamelCasePropertyNamesContractResolver

T:Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver inherits from DefaultContractResolver and simply overrides the JSON property name to be written in camelcase http://en.wikipedia.org/wiki/CamelCase _blank .

ContractResolver

# Custom IContractResolver Examples

Use JsonConverter with IContractResolver

This example sets a T:Newtonsoft.Json.JsonConverter for a type using an IContractResolver. Using a contract resolver here is useful because DateTime is not your own type and it is not possible to place a JsonConverterAttribute on it.

Conditional properties with IContractResolver

This example sets up conditional serialization for a property ConditionalProperties.htm _self using an IContractResolver. This is useful if you want to conditional serialize a property but don't want to add additional methods to your type.

T:Newtonsoft.Json.Serialization.IContractResolver
T:Newtonsoft.Json.Serialization.DefaultContractResolver
T:Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver