用C#转换C#中的Json [英] Convert Json in C# with data

查看:82
本文介绍了用C#转换C#中的Json的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有很多`json`文件要转换成`C#`。在`Visual Studio 2017`中,我使用`Paste as json`来使用`C#`中的模式。简单。
I have a lot of `json` files to convert in `C#`. In `Visual Studio 2017` I use `Paste as json` to have the schema in `C#`. Easy.

推荐答案

您需要安装
NewtonSoft.JSON nuget包
然后您可以使用它将JSON反序列化到您的c#类,如:

You need to install the NewtonSoft.JSON nuget package and then you can use it to deserialize JSON to your c# class like:

Employees employees = JsonConvert.DeserializeObject<Employees>(json);

有关详细信息,请参阅以下链接:

Refer to the following link for details:

https://www.newtonsoft.com/json/help/html/DeserializeObject.htm

以下是文档的链接:

https://www.newtonsoft.com/json/help/html/R_Project_Documentation.htm

希望它有所帮助!


这篇关于用C#转换C#中的Json的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆