.net 一般处理程序 收接口返回的 json 字符转对象时会多出一对大括号
例:
"{"access_token":"test","expires_in":7200,"permanent_code":"4ckk-TDsphDXzSYCFGPlD4WEzjU1OEEKc_8tMgxNPfA","auth_corp_info":{"corpid":"wpaddjhUY_Q","corp_name":"test","corp_type":"unverified","corp_round_logo_url":"http://p.qpic.cn/pic_wework/1415612393/74723564f7cc73a584ad90fdffe98eb1639e6b1e9557edae/0\",\"corp_square_logo_url\":\"https://p.qlogo.cn/bizmail/O/0\",\"corp_user_max\":200,\"corp_wxqrcode\":\"https://wework.qpic.cn/wwpic/262090_W5YEIvLiQNy35j4_1667870001/0\",\"subject_type\":1,\"corp_scale\":\"51-100人\",\"corp_industry\":\"建筑/房地产\",\"corp_sub_industry\":\"建材装修\",\"location\":\"\"},\"auth_info\":{\"agent\":[{\"agentid\":1000048,\"name\":\"ces开发\",\"square_logo_url\":\"https://wework.qpic.cn/wwpic/248587_c3k_U3VESWKZlPQ_1667292008/0\",\"privilege\":{\"level\":4,\"allow_party\":[],\"allow_user\":[],\"allow_tag\":[],\"extra_party\":[],\"extra_user\":[],\"extra_tag\":[]},\"auth_mode\":1,\"is_customized_app\":false}]},\"auth_user_info\":{\"userid\":\"wokOCOEQAAerEIWXWQwDEnNZhFvvZ-Qw\",\"open_userid\":\"wokOCOEQAAerEIWXWQwDEnNZhFvvZ-Qw\"}}"
通过 JObject json = (JObject)JsonConvert.DeserializeObject(r);转为对象时变成如下
{{
"access_token": "test",
"expires_in": 7200,
"permanent_code": "sA",
"auth_corp_info": {
"corpid": "",
"corp_name": "",
"corp_type": "unverified",
"corp_round_logo_url": "http://p.qpic.cn/pic_wework/1415612393/74723564f7cc73a584ad90fdffe98eb1639e6b1e9557edae/0",
"corp_square_logo_url": "https://p.qlogo.cn/bizmail/a/0",
"corp_user_max": 200,
"corp_wxqrcode": "https://wework.qpic.cn/wwpic/262090_W5YEIvLiQNy35j4_1667870001/0%22,
"subject_type": 1,
"corp_scale": "51-100人",
"corp_industry": "建筑/房地产",
"corp_sub_industry": "建材装修",
"location": ""
},
"auth_info": { },
"auth_mode": 1,
"is_customized_app": false
}
]
},
"auth_user_info": {
"userid": "test-Qw",
"open_userid": "test-Qw"
}
}}
你这个是不不是将前端的json字符串传到后端后,将json字符串反序列化成model对象?如果是这样,你可以参考一下代码:
JavaScriptSerializer js = new JavaScriptSerializer();
GoogleSearchResults results = js.Deserialize(Json);
GoogleSearchResults就是定义的对应的model