下载Newtonsoft.Json.dll
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
namespace ConsoleApplication1
{class Program{static void Main(string[] args){string jsonString = "{\"name\":\"Alice\",\"age\":25}";JObject jsonObject = JObject.Parse(jsonString);string name = jsonObject["name"].ToString();name = jsonObject.Value<string>("name");int age = jsonObject.Value<int>("age");Console.WriteLine("Name: " + name); // 输出:Name: AliceConsole.WriteLine("Age: " + age); // 输出:Age: 25}}
}