Simply use Json.Net’s OptOut attribute. It will take precedence over DataContract.
[DataContract]
[JsonObject(MemberSerialization.OptOut)]
More Related Contents:
- Cannot deserialize the JSON array (e.g. [1,2,3]) into type ‘ ‘ because type requires JSON object (e.g. {“name”:”value”}) to deserialize correctly
- Deserializing JSON to .NET object using Newtonsoft (or LINQ to JSON maybe?)
- Detect if deserialized object is missing a field with the JsonConvert class in Json.NET
- Json.net serialize/deserialize derived types?
- How can I deserialize a child object with dynamic (numeric) key names?
- Deserializing JSON when sometimes array and sometimes object
- Convert Json String to C# Object List
- Cannot deserialize the current JSON object (e.g. {“name”:”value”}) into type ‘System.Collections.Generic.List`1
- How to ignore JsonProperty(PropertyName = “someName”) when serializing json?
- Json.NET deserialize or serialize json string and map properties to different property names defined at runtime
- Deserializing JSON when key values are unknown
- Deserializing dates with dd/MM/yyyy format using Json.Net
- Deserializing JSON with unknown object names
- How to convert datatable to json string using json.net?
- How do I convert an escaped JSON string within a JSON object?
- JToken: Get raw/original JSON value
- Force JSON.NET to include milliseconds when serializing DateTime (even if ms component is zero)
- Additional text encountered after finished reading JSON content:
- Handling decimal values in Newtonsoft.Json
- How to convert Json array to list of objects in c#
- Newtonsoft.Json SerializeObject without escape backslashes
- Custom json serialization for each item in IEnumerable [duplicate]
- How do I get a deeply-nested property from JSON string?
- How to return JSon object
- Is there a way to ignore get-only properties in Json.NET without using JsonIgnore attributes?
- Serializing an interface/abstract object using NewtonSoft.JSON
- Best ways to split a string with matching curly braces
- JSonNet boolean serialization
- Null-coalescing operator returning null for properties of dynamic objects
- Is there a way in Json.NET serialization to distinguish between “null because not present” and “null because null”?