![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
//json 序列化 JObject obj1 = JObject.FromObject(new { id = 1, name = "张三", age = 20 }); Console.WriteLine(obj1.ToString()); //输出: //{ // "id": 1, // "name": "张三", // "age": 20 //} //指定忽略对象的属性 //注:指定的key区分大小写 obj1.Remove("id"); Console.WriteLine(obj1.ToString()); //输出结果: //{ // "name": "张三", // "age": 20 //}
对子类属性(二级数组对象的属性)的属性移除
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
JArray jarr = obj1.SelectToken("images") as JArray; if (jarr != null) foreach (JObject item in jarr) { item.Remove("id"); }