C# json字符串 json验证通过了,但是真正序列化的时候却不行,不能序列化为对象

快乐起航2020 2021-03-09 04:22:33
[{"id":"modulea0f94497-a1bc-4d6a-98e2-c24aedb607c5","pid":"module00000000-0000-0000-0000-000000000000","name":"主页","herf":"","code":"","localize":"menu.Home","dataTarget":"nav","iClass":"fa fa-home","submenu":[]},{"id":"modulea47dd1c4-7b80-44b7-af21-c19832e92b19","pid":"module00000000-0000-0000-0000-000000000000","name":"IEOP","herf":"","code":"IEOP-0001","localize":"menu.IEOP","dataTarget":"nav","iClass":"fa fa-briefcase","submenu":[{"id":"modulec621f665-266d-40f7-8068-bd63067ece7d","pid":"modulea47dd1c4-7b80-44b7-af21-c19832e92b19","name":"资本Capex","herf":"","code":"","localize":"menu.Capex","dataTarget":"nav","iClass":"fa fa-book"},{"id":"module81773e28-8320-4f4b-9bcc-e03eb07a8456","pid":"modulea47dd1c4-7b80-44b7-af21-c19832e92b19","name":"资产Asset","herf":"","code":"","localize":"menu.Asset","dataTarget":"nav","iClass":"fa fa-book"},{"id":"modulebc768551-4b20-43ec-b3be-4e6bfad6a9dd","pid":"modulea47dd1c4-7b80-44b7-af21-c19832e92b19","name":"产能Capacity","herf":"","code":"","localize":"menu.Capacity","dataTarget":"nav","iClass":"fa fa-book"},{"id":"module91dad777-c8dd-4f3c-92a1-1a898a5798b6","pid":"modulea47dd1c4-7b80-44b7-af21-c19832e92b19","name":"效能Efficiency","herf":"","code":"","localize":"menu.Efficiency","dataTarget":"nav","iClass":"fa fa-book"},{"id":"module78b0fac4-2cfe-46fc-b7f2-a2b9a8f36c2a","pid":"modulea47dd1c4-7b80-44b7-af21-c19832e92b19","name":"智能Intelligence","herf":"","code":"","localize":"menu.Intelligence","dataTarget":"nav","iClass":"fa fa-book"},{"id":"moduleb8e9fbbc-43df-498a-a90a-e62f63b836f4","pid":"modulec621f665-266d-40f7-8068-bd63067ece7d","name":"Default","herf":"12343543","code":"","localize":"","dataTarget":"nav","iClass":""},{"id":"moduled27082d5-8fd8-4c8b-9207-e0f8bc22cd00","pid":"module81773e28-8320-4f4b-9bcc-e03eb07a8456","name":"Default","herf":"********************","code":"","localize":"","dataTarget":"nav","iClass":""},{"id":"module9960a1c8-8c1d-46ce-9acc-4b2c83519732","pid":"modulebc768551-4b20-43ec-b3be-4e6bfad6a9dd","name":"人力","herf":"","code":"","localize":"","dataTarget":"nav","iClass":""},{"id":"module7e1afc40-6a49-4ae4-93c6-be2e3aaac825","pid":"modulebc768551-4b20-43ec-b3be-4e6bfad6a9dd","name":"产能MAP","herf":"","code":"","localize":"","dataTarget":"nav","iClass":""},{"id":"modulefaccce4c-7cca-43c6-b6e6-310e91df32dc","pid":"modulebc768551-4b20-43ec-b3be-4e6bfad6a9dd","name":"工时Report System","herf":"","code":"","localize":"","dataTarget":"nav","iClass":""},{"id":"moduleead34d9b-ca41-4ae3-889e-866afff854b5","pid":"modulebc768551-4b20-43ec-b3be-4e6bfad6a9dd","name":"工时 Config GUI","herf":"","code":"","localize":"","dataTarget":"nav","iClass":""},{"id":"module4ecb4ee5-e0a2-4a69-a850-1277da9edfe1","pid":"module9960a1c8-8c1d-46ce-9acc-4b2c83519732","name":"年度预算产量报表","herf":"","code":"","localize":"","dataTarget":"nav","iClass":""},{"id":"modulecbcaa0cb-7103-4df6-a434-1e383c2628e9","pid":"module9960a1c8-8c1d-46ce-9acc-4b2c83519732","name":"编制人力总表","herf":"","code":"","localize":"","dataTarget":"nav","iClass":""},{"id":"moduleff24960b-5acf-4c56-a458-0704120a2124","pid":"module9960a1c8-8c1d-46ce-9acc-4b2c83519732","name":"批量返校人力上传","herf":"","code":"","localize":"","dataTarget":"nav","iClass":""},{"id":"module19c6a011-b5d9-4197-95cc-69dbdcfdd2db","pid":"module9960a1c8-8c1d-46ce-9acc-4b2c83519732","name":"编制人力调整比例配置表","herf":"","code":"","localize":"","dataTarget":"nav","iClass":""},{"id":"modulea0dddf3e-0337-44a0-a086-1fc3474874fe","pid":"module9960a1c8-8c1d-46ce-9acc-4b2c83519732","name":"实际人力报表","herf":"","code":"","localize":"","dataTarget":"nav","iClass":""},{"id":"module00de735e-1ff7-4fa6-af7c-ebc48a549082","pid":"module9960a1c8-8c1d-46ce-9acc-4b2c83519732","name":"离职率报表","herf":"","code":"","localize":"","dataTarget":"nav","iClass":""},{"id":"module13ce354b-7469-4a1e-87fa-6bd3bb5195f0","pid":"module9960a1c8-8c1d-46ce-9acc-4b2c83519732","name":"HR供应人力","herf":"","code":"","localize":"","dataTarget":"nav","iClass":""},{"id":"module1cfbb07d-2d1d-4141-bcfa-d22d87770d64","pid":"module9960a1c8-8c1d-46ce-9acc-4b2c83519732","name":"需求人力总表","herf":"","code":"","localize":"","dataTarget":"nav","iClass":""},{"id":"module6566fe3f-d58a-4e87-81e3-a93e6fb5956c","pid":"module9960a1c8-8c1d-46ce-9acc-4b2c83519732","name":"MNT\u0026TV各Site当月量及人力需求对比状况","herf":"","code":"","localize":"","dataTarget":"nav","iClass":""},{"id":"moduleb62f2dc2-8fe0-45a2-9ef8-8e6b9909cdfe","pid":"module9960a1c8-8c1d-46ce-9acc-4b2c83519732","name":"Site每月量及人力需求对比状况","herf":"","code":"","localize":"","dataTarget":"nav","iClass":""},{"id":"modulee01fe324-7b79-46cc-a9af-29c2d5d4cb3d","pid":"module9960a1c8-8c1d-46ce-9acc-4b2c83519732","name":"人力目标base系数配置表","herf":"","code":"","localize":"","dataTarget":"nav","iClass":""},{"id":"moduleefdbff5e-3f59-4582-8c43-6a2cc308374b","pid":"module9960a1c8-8c1d-46ce-9acc-4b2c83519732","name":"年度预算折量报表","herf":"","code":"","localize":"","dataTarget":"nav","iClass":""},{"id":"moduledbe0a96c-e991-4694-a76b-285c5e1b019d","pid":"module9960a1c8-8c1d-46ce-9acc-4b2c83519732","name":"缺勤率配置表","herf":"","code":"","localize":"","dataTarget":"nav","iClass":""},{"id":"module259b6b0b-8d66-46c8-b855-69b15e5cb347","pid":"module9960a1c8-8c1d-46ce-9acc-4b2c83519732","name":"工种分类配置表","herf":"","code":"","localize":"","dataTarget":"nav","iClass":""},{"id":"module80b16907-6288-45de-8425-06e9ed846e33","pid":"module9960a1c8-8c1d-46ce-9acc-4b2c83519732","name":"实际人力调整值及预估人力维护表","herf":"","code":"","localize":"","dataTarget":"nav","iClass":""},{"id":"modulebdc9bcbc-c920-450e-9bb5-911d424a3add","pid":"module9960a1c8-8c1d-46ce-9acc-4b2c83519732","name":"TV DL人力达成分析报表相关数据","herf":"","code":"","localize":"","dataTarget":"nav","iClass":""},{"id":"module69d60722-e30a-42dd-be88-90bb9987ce23","pid":"module9960a1c8-8c1d-46ce-9acc-4b2c83519732","name":"MFG每月人力明细报表","herf":"","code":"","localize":"","dataTarget":"nav","iClass":""},{"id":"modulefee3386f-6635-44a0-825d-088635c256cf","pid":"module9960a1c8-8c1d-46ce-9acc-4b2c83519732","name":"精简人力报表","herf":"","code":"","localize":"","dataTarget":"nav","iClass":""},{"id":"moduleeddd10c4-aef4-4e02-838e-06748c5a59f3","pid":"module9960a1c8-8c1d-46ce-9acc-4b2c83519732","name":"MFG IDL\u0026DL每月月底人力报表","herf":"","code":"","localize":"","dataTarget":"nav","iClass":""},{"id":"moduleeafb7870-333e-449c-be8e-2595b808fc6d","pid":"module9960a1c8-8c1d-46ce-9acc-4b2c83519732","name":"DL人力达成分析报表","herf":"","code":"","localize":"","dataTarget":"nav","iClass":""},{"id":"module2a95aeef-b00c-4a76-80fa-56d70981781e","pid":"module9960a1c8-8c1d-46ce-9acc-4b2c83519732","name":"TV DL人力达成分析报表","herf":"","code":"","localize":"","dataTarget":"nav","iClass":""},{"id":"module6fb9ea2b-b584-4590-b20d-68267272c8f2","pid":"module9960a1c8-8c1d-46ce-9acc-4b2c83519732","name":"大图-MNT/TV各Site人力及工种比例图表","herf":"","code":"","localize":"","dataTarget":"nav","iClass":""},{"id":"module693f9082-1430-471c-8be3-7de4a45fb6d4","pid":"module9960a1c8-8c1d-46ce-9acc-4b2c83519732","name":"年度预算人力-DL、年度预算人力-IDL","herf":"","code":"","localize":"","dataTarget":"nav","iClass":""},{"id":"module626d7133-0204-4841-b900-b854a890c43c","pid":"module9960a1c8-8c1d-46ce-9acc-4b2c83519732","name":"大图-Site人力及工种比例图表","herf":"","code":"","localize":"","dataTarget":"nav","iClass":""},{"id":"module392028fe-9514-41e0-82e6-74f306bd33ec","pid":"module9960a1c8-8c1d-46ce-9acc-4b2c83519732","name":"大图-MNT BG/TV BG产量\u0026折量\u0026人力每月对比图","herf":"","code":"","localize":"","dataTarget":"nav","iClass":""},{"id":"modulea8aba448-9b55-49b6-b9f3-723247b2527f","pid":"module9960a1c8-8c1d-46ce-9acc-4b2c83519732","name":"大图-Site产量\u0026折量\u0026人力每月对比图","herf":"","code":"","localize":"","dataTarget":"nav","iClass":""},{"id":"module5dbcf34b-47cd-499f-8f2e-0e2ccec81ca0","pid":"module9960a1c8-8c1d-46ce-9acc-4b2c83519732","name":"MNT BG/TV BG人力达成分析搭桥图","herf":"","code":"","localize":"","dataTarget":"nav","iClass":""},{"id":"modulee93c22bc-cadc-4549-9539-54cad6903912","pid":"module9960a1c8-8c1d-46ce-9acc-4b2c83519732","name":"Site人力达成分析搭桥图","herf":"","code":"","localize":"","dataTarget":"nav","iClass":""},{"id":"module438fee3d-c07d-4801-86ec-2ff2c108498e","pid":"module9960a1c8-8c1d-46ce-9acc-4b2c83519732","name":"TV BG DL人力达成分析图","herf":"","code":"","localize":"","dataTarget":"nav","iClass":""},{"id":"moduleb782e130-97d9-4313-b7f2-c7af17e640e3","pid":"module9960a1c8-8c1d-46ce-9acc-4b2c83519732","name":"Site DL人力达成分析图","herf":"","code":"","localize":"","dataTarget":"nav","iClass":""},{"id":"moduled377325e-ec97-4630-b126-0ae2dd8ee2c4","pid":"module9960a1c8-8c1d-46ce-9acc-4b2c83519732","name":"制程配置表","herf":"","code":"","localize":"","dataTarget":"nav","iClass":""}]}]

简单来说!就2个对象,第二个对象包含二级菜单,但就是序列化的时候
JavaScriptSerializer serializer = new JavaScriptSerializer();
Dictionary<string, object> json = serializer.DeserializeObject(input_json) as Dictionary<string, object>;
json为null

...全文
104 点赞 收藏 3
写回复
3 条回复
精锐掷矛手 03月09日
序列和反序列的对象不一致,楼上正解
回复 点赞
欧皇神降术 03月09日
你这是数组不是字典,类型为 List<Dictionary<string, object>>
回复 点赞
快乐起航2020 03月09日
在线等大佬!谢谢
回复 点赞
发动态
发帖子
.NET技术其他语言
创建于2007-09-28

1536

社区成员

1.2w+

社区内容

.NET技术 其他语言讨论
社区公告
暂无公告