I'm trying to customize JSON serialization using RestSharp and got a suggestion to use the JsonProperty attribute, which I believe is a Newtonsoft.Json attribute. What I'm trying:
public class MyClass {
[JsonProperty("myField")]
public string MyField {get;set;}
[JsonProperty("myOtherField")]
public string MyOtherField {get;set;}
}
When the object is serialised, the resulting JSON is
{"MyField": "fieldvalue", "MyOtherField": "otherfieldvalue"} rather than what I want, which is: {"myField": "fieldvalue", "myOtherField": "otherfieldvalue"}
So it seems that RestSharp is ignoring the JsonProperty attributes I'm specifying.
I'm using RestSharp for MonoTouch, and I have added Newtonsoft.Json.MonoTouch as a reference in the project.