C# Serialize object via System.Text.Json
作者:互联网
using System.Text.Json; static void TextJsonDemo() { var obj = new { Id = 1, Name = "Fred", Age = 33, Org = new[] { new { Id=1, Name="MS" }, new { Id=2, Name="SMF" }, new { Id=3, Name="Agile" } } }; string jsonValue = JsonSerializer.Serialize(obj); Console.WriteLine(jsonValue); }
标签:jsonValue,via,Name,C#,Text,System,Json,new,Id 来源: https://www.cnblogs.com/Fred1987/p/14032458.html