Пример #1
0
 public void JSON_Test()
 {
     Person person = new Person();
     person.Name = "HeJun";
     person.Age = 26;
     person.something = "xxxxxxxxxxxxx";
     string strSerializeJSON = JsonConvert.SerializeObject(person);
     Console.WriteLine(strSerializeJSON);
 }
Пример #2
0
 public void JSON_Test()
 {
     Person person = new Person();
     person.Name = "HeJun";
     person.Age = 26;
     person.something = "yyyyyyyyyyy";
     string strSerializeJSON = JsonConvert.SerializeObject(person);
     Person user = (Person)JsonConvert.DeserializeObject(strSerializeJSON, typeof(Person));
     Console.WriteLine(user.Name);
 }