C#之Json操作
创建好一个C#工程过后,点击Visual Studio上方的工具-NuGet包管理器-管理解决方案的NuGet程序包,点击浏览,在下方的框框中搜索Json,找到Newtonsoft.Json:

添加好了过后
需要在自己的代码中添加
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
这两个引用
使用示例:
生成一个Json对象:
JArray array = new JArray(); array.Add("Manual text");
array.Add(new DateTime(2000, 5, 23));
JObject o = new JObject();
o["MyArray"] = array;
string json = o.ToString();
解析一个json字符串
string json = @"[ 'Small', 'Medium', 'Large' ]";
JArray a = JArray.Parse(json);
Console.WriteLine(a.ToString());
完整的使用例子可以查看链接:
https://www.newtonsoft.com/json/help/html/