Вот Json
{
"date2" : "20140414",
"min" : {
"denial" : 0,
"visits" : 2,
"new_visitors_perc" : 0.7857,
"page_views" : 14,
"visit_time" : 30,
"depth" : 1.6154,
"new_visitors" : 2,
"visitors" : 2
},
"max" : {
"denial" : 0.3125,
"visits" : 19,
"new_visitors_perc" : 1,
"page_views" : 50,
"visit_time" : 354,
"depth" : 7,
"new_visitors" : 17,
"visitors" : 19
},
"data" : [
{
"wday" : 6,
"denial" : 0,
"visits" : 2,
"new_visitors_perc" : 1,
"page_views" : 14,
"date" : "20140413",
"visit_time" : 354,
"depth" : 7,
"new_visitors" : 2,
"visitors" : 2,
"id" : "20140413"
},
{
"wday" : 5,
"denial" : 0.2308,
"visits" : 13,
"new_visitors_perc" : 0.8333,
"page_views" : 21,
"date" : "20140412",
"visit_time" : 124,
"depth" : 1.6154,
"new_visitors" : 10,
"visitors" : 12,
"id" : "20140412"
},
{
"wday" : 4,
"denial" : 0.3125,
"visits" : 16,
"new_visitors_perc" : 1,
"page_views" : 36,
"date" : "20140411",
"visit_time" : 211,
"depth" : 2.25,
"new_visitors" : 16,
"visitors" : 16,
"id" : "20140411"
},
{
"wday" : 3,
"denial" : 0.0526,
"visits" : 19,
"new_visitors_perc" : 0.8947,
"page_views" : 50,
"date" : "20140410",
"visit_time" : 84,
"depth" : 2.6316,
"new_visitors" : 17,
"visitors" : 19,
"id" : "20140410"
},
{
"wday" : 2,
"denial" : 0.2308,
"visits" : 13,
"new_visitors_perc" : 0.8462,
"page_views" : 22,
"date" : "20140409",
"visit_time" : 31,
"depth" : 1.6923,
"new_visitors" : 11,
"visitors" : 13,
"id" : "20140409"
},
{
"wday" : 1,
"denial" : 0.2857,
"visits" : 14,
"new_visitors_perc" : 0.7857,
"page_views" : 30,
"date" : "20140408",
"visit_time" : 30,
"depth" : 2.1429,
"new_visitors" : 11,
"visitors" : 14,
"id" : "20140408"
}
],
"rows" : 6,
"date1" : "20140408",
"id" : "6673690",
"goals" : [],
"totals" : {
"denial" : 0.2078,
"visits" : 77,
"new_visitors_perc" : 0.9178,
"page_views" : 173,
"visit_time" : 105,
"depth" : 2.2468,
"new_visitors" : 67,
"visitors" : 73
}
}
Модель на основе json
public class Min
{
public int denial { get; set; }
public int visits { get; set; }
public double new_visitors_perc { get; set; }
public int page_views { get; set; }
public int visit_time { get; set; }
public double depth { get; set; }
public int new_visitors { get; set; }
public int visitors { get; set; }
}
public class Max
{
public double denial { get; set; }
public int visits { get; set; }
public int new_visitors_perc { get; set; }
public int page_views { get; set; }
public int visit_time { get; set; }
public int depth { get; set; }
public int new_visitors { get; set; }
public int visitors { get; set; }
}
public class Datum
{
public int wday { get; set; }
public double denial { get; set; }
public int visits { get; set; }
public double new_visitors_perc { get; set; }
public int page_views { get; set; }
public string date { get; set; }
public int visit_time { get; set; }
public double depth { get; set; }
public int new_visitors { get; set; }
public int visitors { get; set; }
public string id { get; set; }
}
public class Totals
{
public double denial { get; set; }
public int visits { get; set; }
public double new_visitors_perc { get; set; }
public int page_views { get; set; }
public int visit_time { get; set; }
public double depth { get; set; }
public int new_visitors { get; set; }
public int visitors { get; set; }
}
public class StatTrafficSummary
{
public string date2 { get; set; }
public Min min { get; set; }
public Max max { get; set; }
public List<Datum> data { get; set; }
public int rows { get; set; }
public string date1 { get; set; }
public string id { get; set; }
public List<object> goals { get; set; }
public Totals totals { get; set; }
}
=======================================
======================================================
Т.е. модель нормально заполняется. когда JsonConvert.DeserializeObject(response);
но когда дело доходит до представления то вылетает ошибка
Элемент модели, переданный в словарь, имеет тип "www.Models.API.Ya.StatTrafficSummary", но для этого словаря требуется элемент модели типа "System.Collections.Generic.IEnumerable`1[www.Models.API.Ya.StatTrafficSummary]".