-
Автор темы
- #1
Имеется вот такой json который привел к строке
Сделал такой вот класс
Как его десериализовать? Получается только сделать n stats, и все они null
JSON:
"[{\"field\":\"kills\",\"n\":1396,\"sum\":15852},{\"field\":\"deaths\",\"n\":1396,\"sum\":6178},{\"field\":\"assists\",\"n\":1396,\"sum\":13231},{\"field\":\"kda\",\"n\":1396,\"sum\":7687},{\"field\":\"gold_per_min\",\"n\":1396,\"sum\":795689},{\"field\":\"xp_per_min\",\"n\":1396,\"sum\":981896},{\"field\":\"last_hits\",\"n\":1396,\"sum\":359590},{\"field\":\"denies\",\"n\":1396,\"sum\":17459},{\"field\":\"lane_efficiency_pct\",\"n\":569,\"sum\":41714},{\"field\":\"duration\",\"n\":1396,\"sum\":3009852},{\"field\":\"level\",\"n\":1396,\"sum\":31204},{\"field\":\"hero_damage\",\"n\":1396,\"sum\":41783880},{\"field\":\"tower_damage\",\"n\":1396,\"sum\":5962888},{\"field\":\"hero_healing\",\"n\":1396,\"sum\":641401},{\"field\":\"stuns\",\"n\":570,\"sum\":18618.795226950013},{\"field\":\"tower_kills\",\"n\":570,\"sum\":967},{\"field\":\"neutral_kills\",\"n\":570,\"sum\":61459},{\"field\":\"courier_kills\",\"n\":570,\"sum\":128},{\"field\":\"purchase_tpscroll\",\"n\":503,\"sum\":3388},{\"field\":\"purchase_ward_observer\",\"n\":405,\"sum\":982},{\"field\":\"purchase_ward_sentry\",\"n\":213,\"sum\":504},{\"field\":\"purchase_gem\",\"n\":21,\"sum\":21},{\"field\":\"purchase_rapier\",\"n\":5,\"sum\":5},{\"field\":\"pings\",\"n\":565,\"sum\":51657},{\"field\":\"throw\",\"n\":278,\"sum\":759579},{\"field\":\"comeback\",\"n\":292,\"sum\":569181},{\"field\":\"stomp\",\"n\":292,\"sum\":5508210},{\"field\":\"loss\",\"n\":278,\"sum\":5089224},{\"field\":\"actions_per_min\",\"n\":570,\"sum\":161302}]"
C#:
class APITotals
{
public class Stats
{
public string field { get; set; }
public int? n { get; set; }
public double? sum { get; set; }
}
public class Root
{
public List<Stats> Stats { get; set; }
}
}