Как привязать данные json к datagridview в приложении C# windows
мой формат json выглядит так
..................
{
"шаблон": {
"раздел": "всего",
"totalRecievedTillDate": null,
"receivedFiles": "0",
"attendedFiles": "0",
"pendingFiles": "0",
"totalActionPendingTillDate": null,
"totalActionCompletedTappal": null,
"last15DaysActionCompleted": null,
"last15DaysRecievedTappal": null
},
"sectiontappals": [
{
"секция": "Коллекторат-это секция",
"totalRecievedTillDate": null,
"receivedFiles": "0",
"attendedFiles": "0",
"pendingFiles": "0",
"totalActionPendingTillDate": null,
"totalActionCompletedTappal": null,
"last15DaysActionCompleted": null,
"last15DaysRecievedTappal": null
},
{
""раздел: "Collectorate-B раздел",
"totalRecievedTillDate": null,
"receivedFiles": "0",
"attendedFiles": "0",
"pendingFiles": "0",
"totalActionPendingTillDate": null,
"totalActionCompletedTappal": null,
"last15DaysActionCompleted": null,
"last15DaysRecievedTappal": null
},
{
"секция": "Коллекторат-с секция",
"totalRecievedTillDate": null,
"receivedFiles": "0",
"attendedFiles": "0",
"pendingFiles": "0",
"totalActionPendingTillDate": null,
"totalActionCompletedTappal": null,
"last15DaysActionCompleted": null,
"last15DaysRecievedTappal": null
},
{
"секция": "секция Коллектората-Д",
"totalRecievedTillDate": null,
"receivedFiles": "0",
"attendedFiles": "0",
"pendingFiles": "0",
"totalActionPendingTillDate": null,
"totalActionCompletedTappal": null,
"last15DaysActionCompleted": null,
"last15DaysRecievedTappal": null
},
{
""раздел: "Collectorate-е секции",
"totalRecievedTillDate": null,
"receivedFiles": "0",
"attendedFiles": "0",
"pendingFiles": "0",
"totalActionPendingTillDate": null,
"totalActionCompletedTappal": null,
"last15DaysActionCompleted": null,
"last15DaysRecievedTappal": null
},
{
"секция": "Коллекторат-секция F и G",
"totalRecievedTillDate": null,
"receivedFiles": "0",
"attendedFiles": "0",
"pendingFiles": "0",
"totalActionPendingTillDate": null,
"totalActionCompletedTappal": null,
"last15DaysActionCompleted": null,
"last15DaysRecievedTappal": null
},
{
""раздел: "Collectorate-раздел H",
"totalRecievedTillDate": null,
"receivedFiles": "0",
"attendedFiles": "0",
"pendingFiles": "0",
"totalActionPendingTillDate": null,
"totalActionCompletedTappal": null,
"last15DaysActionCompleted": null,
"last15DaysRecievedTappal": null
},
{
"секция": "секция Коллектората-ИАП",
"totalRecievedTillDate": null,
"receivedFiles": "0",
"attendedFiles": "0",
"pendingFiles": "0",
"totalActionPendingTillDate": null,
"totalActionCompletedTappal": null,
"last15DaysActionCompleted": null,
"last15DaysRecievedTappal": null
},
{
""раздел: "Collectorate-ЛНР разделе",
"totalRecievedTillDate": null,
"receivedFiles": "0",
"attendedFiles": "0",
"pendingFiles": "0",
"totalActionPendingTillDate": null,
"totalActionCompletedTappal": null,
"last15DaysActionCompleted": null,
"last15DaysRecievedTappal": null
},
{
""раздел: "Collectorate-ЛП разделе",
"totalRecievedTillDate": null,
"receivedFiles": "0",
"attendedFiles": "0",
"pendingFiles": "0",
"totalActionPendingTillDate": null,
"totalActionCompletedTappal": null,
"last15DaysActionCompleted": null,
"last15DaysRecievedTappal": null
},
{
"секция": "секция Коллектората-ЛР",
"totalRecievedTillDate": null,
"receivedFiles": "0",
"attendedFiles": "0",
"pendingFiles": "0",
"totalActionPendingTillDate": null,
"totalActionCompletedTappal": null,
"last15DaysActionCompleted": null,
"last15DaysRecievedTappal": null
},
{
"раздел": "нет",
"totalRecievedTillDate": null,
"receivedFiles": "0",
"attendedFiles": "0",
"pendingFiles": "0",
"totalActionPendingTillDate": null,
"totalActionCompletedTappal": null,
"last15DaysActionCompleted": null,
"last15DaysRecievedTappal": null
}
]
}
...............
я хочу привязать это к моему представлению datagrid, но не могу этого сделать. пожалуйста помогите
мне нужны такие столбцы, как :раздел, totalRecievedTillDate,receivedFiles,attendedFiles,pendingFiles,totalActionPendingTillDate,totalActionCompletedTappal,last15DaysActionCompleted,last15DaysRecievedTappal
Что я уже пробовал:
использование (WebClient wc = новый WebClient())
{
ВАР в JSON = туалет.DownloadString("URL-адрес");
var user = JsonConvert.DeserializeObject<List<clsdashbord>>(json);
datagrid1.DataSource = пользователь;
}