The below code wont map false
over a true
property using JsonConvert.PopulateObject
. The other properties work just fine. Am I doing something wrong?
JsonConvert.PopulateObject(json, request);
JSON
{ "EventId": 146282, "Name": "api division 9", "Order": 4, "Description": "test", "Active": false }
Account.cs
[DataContract(Name = "Request", Namespace = "")]
public class ApiCreateDivisionRequest : ApiAuthorizedRequest
{
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public bool Active { get; set; }
EmitDefaultValue
needs to be true