I'm receiving the following Json response:
{"time_series_data":"[[2013-07-23T09:45:00,0.991],[2013-07-23T10:00:00,1.047],[2013-07-23T10:15:00,0.069],[2013-07-23T10:30:00,1.001],[2013-07-23T10:45:00,0.947],[2013-07-23T11:00:00,0.278],[2013-07-23T11:15:00,0.48],[2013-07-23T11:30:00,0.709],[2013-07-23T11:45:00,1.315],[2013-07-23T12:00:00,0.89],[2013-07-23T12:15:00,0.31],[2013-07-23T12:30:00,0.121],[2013-07-23T12:45:00,0.593],[2013-07-23T13:00:00,0.513],[2013-07-23T13:15:00,0.222],[2013-07-23T13:30:00,1.759],[2013-07-23T13:45:00,1.715],[2013-07-23T14:00:00,1.439],[2013-07-23T14:15:00,0.448],[2013-07-23T14:30:00,0.105]]"}
How would I read these dates and doubles into a list?
I've tried using Json.net, but I can't quite determine what the value collection above is called. Using the following code, I can pull out the value between the [[ and ]] brackets, but I'm not sure how to proceed from here.
JsonTextReader jR = new JsonTextReader(new StringReader(WebApiURL));
string data = "";
while (jR.Read())
{
if (jR.Value != null && jR.Value != "time_series_data")
data = jR.Value.ToString();
}
I can work with Json.net or native c#. Suggestions?
2013-07-23T14:15:00needs to be quoted.time_series_data. Double quotes in JSON are required around strings.