I'm having trouble deserialising a JSON string into an object using JSON.net.
I'm calling the serialisation with:
Payload payload = JsonConvert.DeserializeObject<Payload>(string);
However, the resulting Payload object is null. Any ideas why?
My class:
public class Payload
{
public Payload()
{ }
public string Action { get; set; }
public Payload.Bill[] Bills { get; set; }
public string ResourceType { get; set; }
public string Signature { get; set; }
public class Bill
{
public Bill()
{ }
public string Amount { get; set; }
public string Id { get; set; }
public string MerchantId { get; set; }
public DateTimeOffset? PaidAt { get; set; }
public string SourceId { get; set; }
public string SourceType { get; set; }
public string Status { get; set; }
public string Uri { get; set; }
public string UserId { get; set; }
}
}
My JSON string:
{
"payload": {
"bills": [
{
"id": "xxxx",
"status": "withdrawn",
"uri": "xxxx",
"amount": "5.19",
"amount_minus_fees": "5.14",
"source_type": "subscription",
"source_id": "xxx",
"payout_id": "xxx"
}
],
"resource_type": "bill",
"action": "withdrawn",
"signature": "xxx"
}
}