my json string data is
string r= "{"data":
[
{"ForecastID":54239761,"StatusForecast":"Done"},
{"ForecastID":54240102,"StatusForecast":"Done"},
{"ForecastID":54240400,"StatusForecast":"Done"},
{"ForecastID":54240411,"StatusForecast":"Done"},
{"ForecastID":54240417,"StatusForecast":"Done"}
]
}"
and my json class is
public class Datum
{
public string ForecastID { get; set; }
public string StatusForecast { get; set; }
}
public class RootObject
{
public List<Datum> data { get; set; }
}
i run this code
JavaScriptSerializer serializer = new JavaScriptSerializer();
List<Datum> ListAnswers = serializer.Deserialize<List<Datum>>(r);
Console.WriteLine("\n Deserialize: \n" + ListAnswers.Count );
and have 0 count of ListAnswers.Count
but should be 5 pieces.
what wrong? how to properly deserialize json string?