1、打开vs2017

3、创建完成后,进入main 画面

5、在main中实例这个class ,并赋值

7、使用newtonjson 来处理为json

9、完整的代码 class Program { static void Main(string[] args) { ShowData sd = new ShowData() { text1 = "百度", text2 = "baidu", text3 = "百度经验" }; string jsonStr = JsonConvert.SerializeObject(sd); Console.WriteLine(jsonStr); } } public class ShowData { public string text1 { get; set; } public string text2 { get; set; } public string text3 { get; set; } }
