在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
1.先new一个匿名对象,然后再反序列化好处是能点点点,坏处是得先new匿名对象 2.借用Newtonsoft.Json.Linq.JObject.Parse,好处是不需要new匿名对象,坏处是不能点点点 var strModel='{ "UserId": "30260696", "OutLinkUrl": "tt", "blogContent": "tt", "Status": "1", "Content": { "text": "tt", "medias": [{ "original": "http://ysjzpublic001.oss-cn-beijing.aliyuncs.com/circle/965eb72c92a549dd/6FhRuQ/4ef66281-2aab-4a05-8a73-73094817acdd.jpg", "type": 1, "thumbnail": "", "imgwidth": "", "imgheight": "" }, { "original": "http://ysjzpublic001.oss-cn-beijing.aliyuncs.com/circle/965eb72c92a549dd/6FhRuQ/8cf0ee1c-cba4-452a-a84e-dd9a3054df94.png", "type": 1, "thumbnail": "", "imgwidth": "", "imgheight": "" }] } }'; 1.c#反序列化 var blogRequest = Newtonsoft.Json.Linq.JObject.Parse(strModel); var Content=blogRequest["Content"]; var text=blogRequest["Content"]["text"].ToString(); var text=blogRequest["Content"]["medias"][0]["original"].ToString(); 2.js toJsonObject var blogRequest=JSON.Parse(strModel);
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论