JObject jo = JObject.FromObject(pd); if (jo.SelectToken("elements") is JArray ja) { //((JObject)(jae[0])).Remove("type"); JObject jac = (JObject)(ja[0]); if (jac.SelectToken("json") is JObject jc) { List<string> ps = new List<string>() { "fontFamily", "fontSize", "textAlignHorizonral", "textAlignVertical", "letterSpacing", "lineSpacing", "lineMode", "fontStyle" }; foreach (string p in ps) { jc.Remove(p); } } JObject jat = (JObject)(ja[1]); if (jac.SelectToken("json") is JObject jt) { jt.Remove("codeType"); } }
兩個物件移出不同的屬性