c# json解析
来源:互联网 发布:ubuntu 启动xampp 编辑:程序博客网 时间:2024/05/17 18:24
public partial class Default4 : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { var test = SynchronizationJson("{\"head\":{\"password\":\"aa\",\"action\":\"execute\",\"functionid\":\"subexamInfo\",\"sysid\":\"bb",\"timestamp\":\"20131211032719\",\"isdata\":\"1\"},\"parameter\":{\"userid\":\"ss\",\"exscheme\":[{\"answer\":\"00002\",\"id\":\"F\"}],\"telphone\":\"tt\",\"id\":\"B0E99FB0-BB21-4A64-ACC8-D5B0BC75DB5E\"}}"); } public static IDictionary<string, string> SynchronizationJson(string json) { try { IDictionary<string, string> dict = new Dictionary<string, string>(); JavaScriptSerializer js = new JavaScriptSerializer(); DataJsonSet Json = js.Deserialize<DataJsonSet>(json); dict.Add("sysid", Json.head.sysid); dict.Add("sysaccount", Json.head.functionid); dict.Add("syspassword", Json.head.password); return dict; } catch (Exception ex) { IDictionary<string, string> dict = new Dictionary<string, string>(); dict.Add("error", "Json解析错误!" + ex.Message); return dict; } } } [Serializable] public class DataJsonSet { public head head { get; set; } public parameter parameter { get; set; } } [Serializable] public class head { public string sysid { get; set; } public string password { get; set; } public string timestamp { get; set; } public string functionid { get; set; } public string action { get; set; } } [Serializable] public class parameter { public string id { get; set; } public string userid { get; set; } public exscheme[] exscheme { get; set; } } [Serializable] public class exscheme { public string id { get; set; } public string answer { get; set; } }
0 0
- C# 解析JSON -- Newtonsoft.Json
- C# 解析json Newtonsoft.json
- c#解析JSON总结
- C#解析JSON
- C# 解析 json
- C#解析Json
- c# 解析json数据
- C# 解析 json
- C# 实现json解析
- C#解析JSON
- c# 解析json(整理)
- c# json解析
- C# Json解析
- C#解析JSON
- C# json 解析
- C# 解析 Json数据
- C# 解析 json
- C#解析json
- 继承Application实现Android数据共享
- 2013年度总结 -- 向着IT前进
- 使用jquery.pagination.js进行分页处理
- scrollPagination重复加载问题的解决
- Dbutils详解
- c# json解析
- 新人报道!准程序员一枚……
- Android启动过程一
- 【整理】嵌入式系统的各种常见外设
- 黑马程序员----------------------抽象类与接口
- 负载均衡(功能)
- Invalid use of SingleClientConnManager: connection still allocatedMake sure to release the connectio
- VM下linux虚拟机扩容,分区
- 解决浏览器不兼容websocket