使用 dynamic 标记解析JSON字符串(转)

http://www.cnblogs.com/taotaodetuer/p/4171327.html

 

 string jsonStr = "{\"data\": {\"ssoToken\": \"70abd3d8a6654ff189c482fc4842468c\",\"account\":\"admin\",\"userType\":\"platformAdmin\",\"realName\": \"超级管理员\",\"sex\": 0,\"sexName\":\"男\",\"email\":\"alina_dong@163.com\",\"mobile\":\"15120757948\",\"createdDt\": \"2013-08-16 00:00:00\",\"updatedDt\": \"2014-12-10 00:00:00\" },\"isSuccess\": true}"; 
 var loginInfo = JsonConvert.DeserializeObject<dynamic>(jsonStr); 
 var user = loginInfo.data;
 string ssoToken = user.ssoToken;
 string account = user.account;

 

posted @ 2014-12-19 09:02  高山-景行  阅读(224)  评论(0编辑  收藏  举报