Json 程序集:Newtonsoft.Json
程序集:Newtonsoft.Json
引用空间:namespace Newtonsoft.Json
1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.Threading.Tasks; 6 7 namespace JSON 8 { 9 class Program 10 { 11 static void Main(string[] args) 12 { 13 Users user=new Users(){Name = "小明",Age = 56,Sex = true}; 14 string str = Newtonsoft.Json.JsonConvert.SerializeObject(user);//"{\"Name\":\"小明\",\"Age\":56,\"Sex\":true}" 15 } 16 } 17 public class Users 18 { 19 public string Name { get; set; } 20 public byte Age { get; set; } 21 public bool Sex { set; get; } 22 } 23 }
浙公网安备 33010602011771号