我收到以下 Json 响应:
{"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]]"}
我如何将这些日期和双打读入列表?
我试过使用 Json.net,但我不能完全确定上面的值集合被称为什么。使用以下代码,我可以提取 [[ 和 ]] 括号之间的值,但我不确定如何从这里开始。
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();
}
我可以使用 Json.net 或原生 c#。建议?