restsharp/RestSharp — Issue #228: Json Deserialization
Author: deleolowoyo
Created: 2012-03-06 17:29:48+00:00
State: open

I'm having issues deserializing the following Json response. Here is the Json:

[
{
"page": 1,
"pages": 1,
"per_page": "50",
"total": 12
},
[
{
"indicator": {
"id": "EN.ATM.CO2E.KT",
"value": "CO2 emissions (kt)"
},
"country": {
"id": "US",
"value": "United States"
},
"value": null,
"decimal": "0",
"date": "2011"
},
{
"indicator": {
"id": "EN.ATM.CO2E.KT",
"value": "CO2 emissions (kt)"
},
"country": {
"id": "US",
"value": "United States"
},
"value": null,
"decimal": "0",
"date": "2010"
}
]
]

is this class structure correct?

namespace Coolnamespace
{
public class ValueDetail
{
public double Value { get; set; }
public string Date { get; set; }
}

public class EmissionValue
{
public ValueDetail Detail { get; set; }
}

public class Co2Emissions
{
public List EmissionValues { get; set; }
}
}