When serializing to Json, an exception is thrown if the default contract resolver is not used.
Code:
Newtonsoft.Json.JsonConvert.DefaultSettings = () => new JsonSerializerSettings{
ContractResolver = new CamelCasePropertyNamesContractResolver()
};
Review r = new Review {
Comment = "fdsdf"
};
r.ToIndentedJson().Dump();
Exception:
A member with the name 'comment' already exists on 'MXTires.Microdata.Review'. Use the JsonPropertyAttribute to specify another name.
The ToJson methods should specify the contract resolver explicitly to avoid this.
When serializing to Json, an exception is thrown if the default contract resolver is not used.
Code:
Exception:
A member with the name 'comment' already exists on 'MXTires.Microdata.Review'. Use the JsonPropertyAttribute to specify another name.The
ToJsonmethods should specify the contract resolver explicitly to avoid this.