.net开发日志 json

来源:互联网 发布:java js跨域请求 编辑:程序博客网 时间:2024/06/03 19:10

 

通过查询从数据库获得json 数据  

json 转换为 .net 对象

  JPushModel model = new JPushModel();                JObject objt = (JObject)JsonConvert.DeserializeObject(row["NotificationContent"].ToString());                model.NotificationContent = objt;
  public  class JPushModel    {        //发送内容  json数据        public Newtonsoft.Json.Linq.JObject NotificationContent { get; set; }        public string JpushType { get; set; }    }


从json对象中取出子对象的值

  var Json= Newtonsoft.Json.Linq.JObject.Parse(Sjson);                       string JpushType= Json["子对象名"].ToString();


原创粉丝点击