예제 #1
0
 public void TestJsonWindows()
 {
     Person p1 = new Person { Name = "zz" };
     var str = JsonDataContractSerializer.Serialize<Person>(p1);
     var st = XmlDataContractSerializer.Serialize<Person>(p1);
     var json1 = "{\"compress\":\"1\",\"empId\":\"15015\",\"objId\":\"msgreplies\",\"messId\":\"155\"}";
     JsonObject json = JsonObject.Parse(json1);
 }
예제 #2
0
 public void TestJsonNet()
 {
     var p1 = new Person { Name = "zz" };
     Newtonsoft.Json.JsonSerializerSettings settings = new Newtonsoft.Json.JsonSerializerSettings();
     settings.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore;
     var st2r = Newtonsoft.Json.JsonConvert.SerializeObject(p1, Newtonsoft.Json.Formatting.Indented, settings);
     TestModel mo = new TestModel();
     mo.sub = new SubTestModel();
     var ss = mo.ToJson();
     var model = Winchannel_Win10.Model.BaseModel.Create<TestModel>(ss);
 }