Newtonsoft.Json添加项

JObject jo = (JObject)JsonConvert.DeserializeObject(result);
if (jo["code"].ToString() == "0")
{
    string domain=(jo["data"]["AA"].ToString());
    string sourceUrl = jo["data"]["BB"].ToString();
    JObject jdata = jo["data"] as JObject;
    if(jdata!=null)
   jdata.Add("CC", sourceUrl.Replace(domain, "ada").ToString().Replace("\"",""));
}
return jo;

注意,要替换掉""

posted @ 2018-07-27 16:23  zhaogaojian  阅读(606)  评论(0编辑  收藏  举报