我读取了我的 json 文件并设置了一个字符串变量,我正在使用 System.Web.Script.Serialization; FileStream fs = new FileStream(Server.MapPath("odul_en.json"),FileMode.Open,FileAccess.Read); StreamReader sr = new StreamReader(fs); string jsonGelen = sr.ReadToEnd(); var serializer = new JavaScriptSerializer(); var dict = serializer.Deserialize<Dictionary<string, object>>(jsonGelen);当我把断点“var dict= serializer.Deserialize>(jsonGelen);” 行,我收到以下错误;System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken =b77a5c561934e089]]'odul_en.json 像这样; [{"odulID": "130","Ad": "LaQ Creative Toy / Basic 001","Aciklama": "Instead of the gift product, the product is not paid for the price, can not be turned into money. There is no guarantee of the products because of collective purchase. Buying gift product is not returned. Photos are representative, products may vary."},{"odulID": "132","Ad": "Selfie Stick","Aciklama": "Instead of the gift product, the product is not paid for the price, can not be turned into money. There is no guarantee of the products because of collective purchase. Photos are representative, products may vary. Buying gift product is not returned. There is no color option. Suitable for Phones, easy to carry. The open length is 100 cm and the closed length is 23 cm"}]我搜索了解决方法;有人在json文件中说“删除方括号”但没有解决。(我的 .net 框架 3.5 不能使用动态)我该如何解决这个问题,谢谢。
2 回答
- 2 回答
- 0 关注
- 174 浏览
添加回答
举报
0/150
提交
取消