I am deserializing an Json string to Object.This is my Json string need to Deserialized.
{
"response": {
"total_results": 33,
"trades": [
{
"tid": "E231958349",
"num": 1,
"num_iid": 3424234,
"price": 200.07
}]
}
}
I have defined a response model.This is my code:
public class ResponseModel
{
public int total_results { set; get; }
public List<TradeModel> trades{ set; get;}
}
And I also have defined trades model:
public class TradeModel
{
#region Attribute
#region oid
private int tid;
public int Oid
{
get { return tid; }
set { tid = value; }
}
#endregion
#endregion
}
And this is my deserialize code:
public static ResponseModel MapResonseJsonToModel(string json)
{
ResponseModel orderModel = new ResponseModel();
orderModel = JsonConvert.DeserializeObject<ResponseModel>(json);
return orderModel;
}
My question is:Why everytime the total_results return 0,and the trades return null?The correct is 33,and not null trade object!