如何在DataGridView中显示.json文件中的数据?

时间:2018-01-29 14:38:26

标签: c# datagridview json.net

您好我正在开发一个项目,我必须在DataGridView中显示保存在.json文件中的数据。任何帮助或回答对我来说都意味着很多。谢谢!

这是我制作的代码:

    private void showData_Click(object sender, EventArgs e)
    {
        string json = File.ReadAllText(@"C:\Users\Aljaz\Documents\json1.json");
        var dateTimeFormat = new IsoDateTimeConverter { DateTimeFormat = "dd/MM/yyyy" };

        Employee employee = JsonConvert.DeserializeObject<Employee>(json, dateTimeFormat);
        myDGView.DataSource = employee;

0 个答案:

没有答案
相关问题