c#json操作

2021-04-09 03:24

阅读:501

标签:pts   roc   ext   c#   jsp   send   bsp   nod   row   

 引用中 增加 system.web.Extension; 和system.web.services ;

 json 转对象

private T scriptDeserialize(string jsonstr)
{
   JavaScriptSerializer js = new JavaScriptSerializer();
   return js.Deserialize(jsonstr);
}

 

对象转json

private string getJsonStr(JsonSendPlayback jsplaybcak)
{
    JavaScriptSerializer js = new JavaScriptSerializer();
     Dictionary drow = new Dictionary();
   drow.Add("videoId", jsplaybcak.VideoId);
   drow.Add("mobId", jsplaybcak.MobId);
   drow.Add("nodeId", jsplaybcak.NodeId);
   drow.Add("highPriority", jsplaybcak.HighPriority.ToString());
   drow.Add("overwrite", jsplaybcak.Overwrite.ToString());
   drow.Add("profile", jsplaybcak.Profile);
   drow.Add("ProcessName", jsplaybcak.ProcessName);
   drow.Add("device", jsplaybcak.Device);
   return js.Serialize(drow);
}

c#json操作

标签:pts   roc   ext   c#   jsp   send   bsp   nod   row   

原文地址:https://www.cnblogs.com/ssjsk/p/9073102.html


评论


亲,登录后才可以留言!