json 转匿名对象 并新增 字段
电脑版发表于:2021/7/6 17:42
//转对象
JObject obj = JObject.Parse(parameter);
obj.Add("key", "value");
如果是集合
List<dynamic> DynamicObject = JsonConvert.DeserializeObject<List<dynamic>>(parameter);
dynamic class= new System.Dynamic.ExpandoObject();
var dic = (IDictionary<string, object>)class;
dic.Add("key", "value");
DynamicObject.Add(dic);