I am using JSON.NET to deserialize but having the object instantiated with all its properties set to null.
JSON
{
"verify-purchase":
{
"item_name":"Pipeline.NET Task Scheduler",
"item_id":"1111111",
"created_at":"Wed Jun 12 15:56:02 +1000 2013",
"buyer":"xxxxxxxx",
"licence":"Regular License"
}
}
C# Class
public class VerifyPurchase
{
[JsonProperty("item_name")]
public string ItemName { get; set; }
[JsonProperty("item_id")]
public string ItemId { get; set; }
[JsonProperty("created_at")]
public string CreatedAt { get; set; }
[JsonProperty("buyer")]
public string Buyer { get; set; }
[JsonProperty("licence")]
public string Licence { get; set; }
}
C# Deserialization
var purchase = JsonConvert.DeserializeObject<VerifyPurchase>(jsonText);
This seems simple enough. What is going wrong here to result in NULL properties?