在c#中使用json.net反序列化json对象,读取/强制转换错误
本文关键字:json 读取 错误 转换 反序列化 net 对象 | 更新日期: 2023-09-27 17:51:01
我正在对json文件进行反序列化,该文件具有以下字段:
{ 'IdTechnician': '4', 'DescTechnician': 'Surname Name', 'LoginTechnician': 'username', 'TypeTechnician': '1', 'TelephoneTechnician': '+123456789', 'SignatureTechnician': '????''u0000''u0010JFIF''u0000''u0001''u0002''u0001''u0001,''u0001,''u0000''u0000??''u0000''u000eAdobe''u0000d''u0000''u0000''u0000''u0000''u0001??''t?Exif''u0000''u0000MM''u0000*''u0000''u0000''u0000''b''u0000''u0007''u0001''u0012''u0000''u0003''u0000''u0000''u0000''u0001''u0000''u0001''u0000''u0000''u0001''u001a''u0000''u0005''u0000''u0000''u0000''u0001''u0000''u0000''u0000b''u0001''u001b''u0000''u0005''u0000''u0000''u0000''u0001''u0000''u0000''u0000j''u0001(''u0000''u0003''u0000''u0000''u0000''u0001''u0000''u0002''u0000''u0000''u00011''u0000''u0002''u0000''u0000''u0000''u001c''u0000''u0000''u0000r''u00012''u0000''u0002''u0000''u0000''u0000''u0014''u0000''u0000''u0000??i''u0000''u0004''u0000''u0000''u0000''u0001''u0000''u0000''u0000?''u0000''u0000''u0000?''u0001,''u0000''u0000''u0000''u0001''u0000''u0000''u0001,''u0000''u0000''u0000''u0001''u0000''u0000Adobe Photoshop CS4 Windows''u00002011:03:09 17:10:23''u0000''u0000''u0003?''u0001''u0000''u0003''u0000''u0000''u0000''u0001??''u0000''u0000?''u0002''u0000''u0004''u0000''u0000''u0000''u0001''u0000''u0000''u0000??''u0003''u0000''u0004''u0000''u0000''u0000''u0001''u0000''u0000''u0000-''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0006''u0001''u0003''u0000''u0003''u0000''u0000''u0000''u0001''u0000''u0006''u0000''u0000''u0001''u001a''u0000''u0005''u0000''u0000''u0000''u0001''u0000''u0000''u0001''u001c''u0001''u001b''u0000''u0005''u0000''u0000''u0000''u0001''u0000''u0000''u0001$''u0001(''u0000''u0003''u0000''u0000''u0000''u0001''u0000''u0002''u0000''u0000''u0002''u0001''u0000''u0004''u0000''u0000''u0000''u0001''u0000''u0000''u0001,''u0002''u0002''u0000''u0004''u0000''u0000''u0000''u0001''u0000''u0000''b^''u0000''u0000''u0000''u0000''u0000''u0000''u0000H''u0000''u0000''u0000''u0001''u0000''u0000''u0000H''u0000''u0000''u0000''u0001????''u0000''u0010JFIF''u0000''u0001''u0002''u0000''u0000H''u0000H''u0000''u0000??''u0000''fAdobe_CM''u0000''u0002??''u0000''u000eAdobe''u0000d?''u0000''u0000''u0000''u0001??''u0000?''u0000''f''b''b''b''t''b''f''t''t''f''u0011''u000b''n''u000b''u0011''u0015''u000f''f''f''u000f''u0015''u0018''u0013''u0013''u0015''u0013''u0013''u0018''u0011''f''f''f''f''f''f''u0011''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''u0001''r''u000b''u000b''r''u000e''r''u0010''u000e''u000e''u0010''u0014''u000e''u000e''u000e''u0014''u0014''u000e''u000e''u000e''u000e''u0014''u0011''f''f''f''f''f''u0011''u0011''f''f''f''f''f''f''u0011''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f??''u0000''u0011''b''u0000$''u0000?''u0003''u0001''''u0000''u0002''u0011''u0001''u0003''u0011''u0001??''u0000''u0004''u0000''n??''u0001?''u0000''u0000''u0001''u0005''u0001''u0001''u0001''u0001''u0001''u0001''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0003''u0000''u0001''u0002''u0004''u0005''u0006''u0007''b''t''n''u000b''u0001''u0000''u0001''u0005''u0001''u0001''u0001''u0001''u0001''u0001''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0001''u0000''u0002''u0003''u0004''u0005''u0006''u0007''b''t''n''u000b''u0010''u0000''u0001''u0004''u0001''u0003''u0002''u0004''u0002''u0005''u0007''u0006''b''u0005''u0003''f3''u0001''u0000''u0002''u0011''u0003''u0004!''u00121''u0005AQa''u0013''q?2''u0006''u0014???B#$''u0015R?b34r??C''u0007%?S???cs5''u0016???&D?TdE??t6''u0017?U?e?????u??F'???????????????Vfv????????7GWgw????????''u0011''u0000''u0002''u0002''u0001''u0002''u0004''u0004''u0003''u0004''u0005''u0006''u0007''u0007''u0006''u00055''u0001''u0000''u0002''u0011''u0003!1''u0012''u0004AQaq''''u0013''u00052??''u0014??B#?R??3$b?r??CS''u0015cs4?%''u0006''u0016???''u0007&5??D?T?''u0017dEU6te??????u??F???????????????Vfv????????'7GWgw???????''u0000''f''u0003''u0001''u0000''u0002''u0011''u0003''u0011''u0000?''u0000?E[??;''u0013''u0006??????Z?0]?????????3?m?t?f}??/????????????:?????''u0000K?''u0000''u0017_?''u0011''u0002?????F5.??''u001b]L??05???<l??qq?}4???C^??''u0000''u0011???''u0000?{?''u0000??oC?e?2???+7''r??&??[?>??z~?^?[-?}??V:??44PQ ''t&''u0002`A''u0012''f??''n?X???j''u001c???????''u0016???w?1??c?????n,????''u0002''u0012?-M??I''u0005)$?IJU?3YM???n?sK?C#v????;k*g??V''u001e????!?h?''u0013?''u0003RVN''u0006''u0016]????h??h????''u0000''u001fv;''u0019??;''u001a?z_???z^?!N?6Krk?''u001a?0?''u0016=???sN?5?-EB???''u001a??^????''u001d?q's??''u001f????z*''nRI$???I???nq''r''u0003?t''t)t?+??G?E??4?''u000b}F????,^???p?''u0019???''u0013'''?''u00034?''u0000?s''u0005_???=?????N??y????????''''?y?io?????w;??c?''u0000?~????j?X??f??c?1???~?I?????''u001c??,?~S???''u0000???GcfU?fN3j????{ls???{?5?1?n???z~??}??''u001e]??????????K^????''u001b??????k?~E??{??P?l???''t>?P?p?''u0005?''u0000??''u0000?????''u0000a''u00133??''u0002?sl??,?m/u??''''??????w?w?????r????r???????,]_??''u0003?o?''r???cY?e?~?u?Mv^5?''u001a?j?c''u0000?''u0017?m?''u00007eh???''u0000*S??:?3?sZ?T???n''u0000''u001a?w?{''u0018????????B??J?''u0000?10?v3?w??????$??V??=??W?mX?Q???????;k=,Ue??X??f&?B?=????????F???g?[n^NmtdWS????????h?????''u001a=OK??????}???''u0011?hv?[?beU?Cn?''u0010''f?1?''u001c?4???''u001b??V?''u0000c??????''u001bE???''u001d?''u000688?????EsN????uXT_????vU-?O?X{''u001df''u0007?''u001f??n???>?]?????=''u001d??Tu*''u001d??n''u0016''u000eP??sK??YT??k???{(k~????????''u0003''u001e???H''u0010D?A???C?g???b?<????<~??,?R?????''u0000??????''rh''rh''u0010''u0000?''u0000''u0013i-.??7?f?''u0018>??Gii''u0005??V?e''u0014''n??6??+?''u0012''u0004?=??~???Oclc?x''u000ec?k?u''u0004''u001d''u001c????D?b??k????W?V????????hs[^???c???g??''u0000??''u0014tS?????ev5????i''u0004???''u0003??m???''''<zQ?|?c??''u0015????????v''u0015''u0015T?dd>?c?,??''u001b''u001d?6?[n???Z?G''u001f?'''??????~;???s?ln77y8?WX;??''u001a?1?no???Uz??J?n????''''`''rI<''u0000?r???W?''u0017d??5''u000e''ro??''u00077??b?K?''u0019?''u0017?? ?????h,ap''u0011?}?????????tG?ul??????-}/c''u001c???''u001f??''u0014?kk~U???}??c???[?'''??L?Z???T?''u00167??ac''u001cX????]??ev;??6????Q?W??>????@7WV???''b??O??????''u0016>???m?''u001c?;!???????q?''u0011?''u001a?+??''u0001??L????''u001a?S?''u0015h????X??,?e~??????h?''u000e?????????''u0000????Z''u0003?''u0015^''r?*0[K-?????''u0005????''u001f??mk??????t??Z???h??k???gc''bkv???#??]g??V?''u000e????D???$??????$??????$?????? ??????'''??????$??????$??????$??????$??????$?????''u000e8Photoshop 3.0''u00008BIM''u0004%''u0000''u0000''u0000''u0000''u0000''u0010''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u00008BIM''u0003?''u0000''u0000''u0000''u0000''u0000''u0010''u0001,''u0000''u0000''u0000''u0001''u0000''u0002''u0001,''u0000''u0000''u0000''u0001''u0000''u00028BIM''u0004&''u0000''u0000''u0000''u0000''u0000''u000e''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000??''u0000''u00008BIM''u0004''r''u0000''u0000''u0000''u0000''u0000''u0004''u0000''u0000''u0000''u001e8BIM''u0004''u0019''u0000''u0000''u0000''u0000''u0000''u0004''u0000''u0000''u0000''u001e8BIM''u0003?''u0000''u0000''u0000''u0000''u0000''t''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0001''u00008BIM'''u0010''u0000''u0000''u0000''u0000''u0000''n''u0000''u0001''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u00028BIM''u0003?''u0000''u0000''u0000''u0000''u0000H''u0000/ff''u0000''u0001''u0000lff''u0000''u0006''u0000''u0000''u0000''u0000''u0000''u0001''u0000/ff''u0000''u0001''u0000???''u0000''u0006''u0000''u0000''u0000''u0000''u0000''u0001''u00002''u0000''u0000''u0000''u0001''u0000Z''u0000''u0000''u0000''u0006''u0000''u0000''u0000''u0000''u0000''u0001''u00005''u0000''u0000''u0000''u0001''u0000-''u0000''u0000''u0000''u0006''u0000''u0000''u0000''u0000''u0000''u00018BIM''u0003?''u0000''u0000''u0000''u0000''u0000p''u0000''u0000??????????????????????''u0003?''u0000''u0000''u0000''u0000??????????????????????''u0003?''u0000''u0000''u0000''u0000??????????????????????''u0003?''u0000''u0000''u0000''u0000??????????????????????''u0003?''u0000''u00008BIM''u0004''b''u0000''u0000''u0000''u0000''u0000''u0010''u0000''u0000''u0000''u0001''u0000''u0000''u0002@''u0000''u0000''u0002@''u0000''u0000''u0000''u00008BIM''u0004''u001e''u0000''u0000''u0000''u0000''u0000''u0004''u0000''u0000''u0000''u00008BIM''u0004''u001a''u0000''u0000''u0000''u0000''u0003O''u0000''u0000''u0000''u0006''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000-''u0000''u0000''u0000?''u0000''u0000''u0000''r''u0000c''u0000o''u0000r''u0000s''u0000i''u0000n''u0000i''u0000a''u0000n''u0000d''u0000r''u0000e''u0000a''u0000''u0000''u0000''u0001''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0001''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000?''u0000''u0000''u0000-''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0001''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0010''u0000''u0000''u0000''u0001''u0000''u0000''u0000''u0000''u0000''u0000null''u0000''u0000''u0000''u0002''u0000''u0000''u0000''u0006boundsObjc''u0000''u0000''u0000''u0001''u0000''u0000''u0000''u0000''u0000''u0000Rct1''u0000''u0000''u0000''u0004''u0000''u0000''u0000''u0000Top long''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000Leftlong''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000Btomlong''u0000''u0000''u0000-''u0000''u0000''u0000''u0000Rghtlong''u0000''u0000''u0000?''u0000''u0000''u0000''u0006slicesVlLs''u0000''u0000''u0000''u0001Objc''u0000''u0000''u0000''u0001''u0000''u0000''u0000''u0000''u0000''u0005slice''u0000''u0000''u0000''u0012''u0000''u0000''u0000''u0007sliceIDlong''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0007groupIDlong''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0006originenum''u0000''u0000''u0000''fESliceOrigin''u0000''u0000''u0000''rautoGenerated''u0000''u0000''u0000''u0000Typeenum''u0000''u0000''u0000''nESliceType''u0000''u0000''u0000''u0000Img ''u0000''u0000''u0000''u0006boundsObjc''u0000''u0000''u0000''u0001''u0000''u0000''u0000''u0000''u0000''u0000Rct1''u0000''u0000''u0000''u0004''u0000''u0000''u0000''u0000Top long''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000Leftlong''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0000Btomlong''u0000''u0000''u0000-''u0000''u0000''u0000''u0000Rghtlong''u0000''u0000''u0000?''u0000''u0000''u0000''u0003urlTEXT''u0000''u0000''u0000''u0001''u0000''u0000''u0000''u0000''u0000''u0000nullTEXT''u0000''u0000''u0000''u0001''u0000''u0000''u0000''u0000''u0000''u0000MsgeTEXT''u0000''u0000''u0000''u0001''u0000''u0000''u0000''u0000''u0000''u0006altTagTEXT''u0000''u0000''u0000''u0001''u0000''u0000''u0000''u0000''u0000''u000ecellTextIsHTMLbool''u0001''u0000''u0000''u0000''bcellTextTEXT''u0000''u0000''u0000''u0001''u0000''u0000''u0000''u0000''u0000''thorzAlignenum''u0000''u0000''u0000''u000fESliceHorzAlign''u0000''u0000''u0000''u0007default''u0000''u0000''u0000''tvertAlignenum''u0000''u0000''u0000''u000fESliceVertAlign''u0000''u0000''u0000''u0007default''u0000''u0000''u0000''u000bbgColorTypeenum''u0000''u0000''u0000''u0011ESliceBGColorType''u0000''u0000''u0000''u0000None''u0000''u0000''u0000''ttopOutsetlong''u0000''u0000''u0000''u0000''u0000''u0000''u0000''nleftOutsetlong''u0000''u0000''u0000''u0000''u0000''u0000''u0000''fbottomOutsetlong''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u000brightOutsetlong''u0000''u0000''u0000''u0000''u00008BIM''u0004(''u0000''u0000''u0000''u0000''u0000''f''u0000''u0000''u0000''u0002??''u0000''u0000''u0000''u0000''u0000''u00008BIM''u0004''u0011''u0000''u0000''u0000''u0000''u0000''u0001''u0001''u00008BIM''u0004''u0014''u0000''u0000''u0000''u0000''u0000''u0004''u0000''u0000''u0000''u00018BIM''u0004''f''u0000''u0000''u0000''u0000''bz''u0000''u0000''u0000''u0001''u0000''u0000''u0000?''u0000''u0000''u0000$''u0000''u0000''u0001?''u0000''u0000C?''u0000''u0000''b^''u0000''u0018''u0000''u0001????''u0000''u0010JFIF''u0000''u0001''u0002''u0000''u0000H''u0000H''u0000''u0000??''u0000''fAdobe_CM''u0000''u0002??''u0000''u000eAdobe''u0000d?''u0000''u0000''u0000''u0001??''u0000?''u0000''f''b''b''b''t''b''f''t''t''f''u0011''u000b''n''u000b''u0011''u0015''u000f''f''f''u000f''u0015''u0018''u0013''u0013''u0015''u0013''u0013''u0018''u0011''f''f''f''f''f''f''u0011''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''u0001''r''u000b''u000b''r''u000e''r''u0010''u000e''u000e''u0010''u0014''u000e''u000e''u000e''u0014''u0014''u000e''u000e''u000e''u000e''u0014''u0011''f''f''f''f''f''u0011''u0011''f''f''f''f''f''f''u0011''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f''f??''u0000''u0011''b''u0000$''u0000?''u0003''u0001''''u0000''u0002''u0011''u0001''u0003''u0011''u0001??''u0000''u0004''u0000''n??''u0001?''u0000''u0000''u0001''u0005''u0001''u0001''u0001''u0001''u0001''u0001''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0003''u0000''u0001''u0002''u0004''u0005''u0006''u0007''b''t''n''u000b''u0001''u0000''u0001''u0005''u0001''u0001''u0001''u0001''u0001''u0001''u0000''u0000''u0000''u0000''u0000''u0000''u0000''u0001''u0000''u0002''u0003''u0004''u0005''u0006''u0007''b''t''n''u000b''u0010''u0000''u0001''u0004''u0001''u0003''u0002''u0004''u0002''u0005''u0007''u0006''b''u0005''u0003''f3''u0001''u0000''u0002''u0011''u0003''u0004!''u00121''u0005AQa''u0013'''q?2''u0006''u0014???B#$''u0015R?b34r??C''u0007%?S???cs5''u0016???&D?TdE??t6''u0017?U?e?????u??F'???????????????Vfv????????7GWgw????????''u0011''u0000''u0002''u0002''u0001''u0002''u0004''u0004''u0003''u0004''u0005''u0006''u0007''u0007''u0006''u00055''u0001''u0000''u0002''u0011''u0003!1''u0012''u0004AQaq''''u0013''u00052??''u0014??B#?R??3$b?r??CS''u0015cs4?%''u0006''u0016???''u0007&5??D?T?''u0017dEU6te??????u??F???????????????Vfv????????'7GWgw???????''u0000''f''u0003''u0001''u0000''u0002''u0011''u0003''u0011''u0000?''u0000?E[??;''u0013''u0006??????Z?0]?????????3?m?t?f}??/????????????:?????''u0000K?''u0000''u0017_?''u0011''u0002?????F5.??''u001b]L??05???<l??qq?}4???C^??''u0000''u0011???''u0000?{?''u0000??oC?e?2???+7''r??&??[?>??z~?^?[-?}??V:??44PQ ''t&''u0002`A''u0012''f??''n?X???j''u001c???????''u0016???w?1??c?????n,????''u0002''u0012?-M??I''u0005)$?IJU?3YM???n?sK?C#v????;k*g??V''u001e????!?h?''u0013?''u0003RVN''u0006''u0016]????h??h????''u0000''u001fv;''u0019??;''u001a?z_???z^?!N?6Krk?''u001a?0?''u0016=???sN?5?-EB???''u001a??^????''u001d?q's??''u001f????z*''nRI$???I???nq''r''u0003?t''t)t?+??G?E??4?''u000b}F????,^???p?''u0019???''u0013'''?''u00034?''u0000?s''u0005_???=?????N??y????????''''?y?io?????w;??c?''u0000?~????j?X??f??c?1???~?I?????''u001c??,?~S???''u0000???GcfU?fN3j????{ls???{?5?1?n???z~??}??''u001e]??????????K^????''u001b??????k?~E??{??P?l???''t>?P?p?''u0005?''u0000??''u0000?????''u0000a''u00133??''u0002?sl??,?m/u??''''??????w?w?????r????r???????,]_??''u0003?o?''r???cY?e?~?u?Mv^5?''u001a?j?c''u0000?''u0017?m?''u00007eh???''u0000*S??:?3?sZ?T???n''u0000''u001a?w?{''u0018????????B??J?''u0000?10?v3?w??????$??V??=??W?mX?Q???????;k=,Ue??X??f&?B?=????????F???g?[n^NmtdWS????????h?????''u001a=OK??????}???''u0011?hv?[?beU?Cn?''u0010''f?1?''u001c?4???''u001b??V?''u0000c??????''u001bE???''u001d?''u000688?????EsN????uXT_????vU-?O?X{''u001df''u0007?''u001f??n???>?]?????=''u001d??Tu*''u001d??n''u0016''u000eP??sK??YT??k???{(k~????????''u0003''u001e???H''u0010D?A???C?g???b?<????<~??,?R?????''u0000??????''rh''rh''u0010''u0000?''u0000''u0013i-.??7?f?''u0018>??Gii''u0005??V?e''u0014''n??6??+?''u0012''u0004?=??~???Oclc?x''u000ec?k?u''u0004''u001d''u001c????D?b??k????W?V????????hs[^???c???g??''u0000??''u0014tS?????ev5????i''u0004???''u0003??m???''''<zQ?|?c??''u0015????????v''u0015''u0015T?dd>?c?,??''u001b''u001d?6?[n???Z?G''u001f?'''??????~;???s?ln77y8?WX;??''u001a?1?no???Uz??J?n????''''`''rI<''u0000?r???W?''u0017d??5''u000e''ro??''u00077??b?K?''u0019?''u0017?? ?????h,ap''u0011?}?????????tG?ul??????-}/c''u001c???''u001f??''u0014?kk~U???}??c???[?'''??L?Z???T?''u00167??ac''u001cX????]??ev;??6????Q?W??>????@7WV???''b??O??????''u0016>???m?''u001c?;!???????q?''u0011?''u001a?+??''u0001??L????''u001a?S?''u0015h????X??,?e~??????h?''u000e?????????''u0000????Z''u0003?''u0015^''r?*0[K-?????''u0005????''u001f??mk??????t??Z???h??k???gc''bkv???#??]g??V?''u000e????D???$??????$??????$?????? ??????'''??????$??????$??????$??????$??????$???8BIM''u0004!''u0000''u0000''u0000''u0000''u0000U''u0000''u0000''u0000''u0001''u0001''u0000''u0000''u0000''u000f''u0000A''u0000d''u0000o''u0000b''u0000e''u0000 ''u0000P''u0000h''u0000o''u0000t''u0000o''u0000s''u0000h''u0000o''u0000p''u0000''u0000''u0000''u0013''u0000A''u0000d''u0000o''u0000b''u0000e''u0000 ''u0000P''u0000h''u0000o''u0000t''u0000o''u0000s''u0000h''u0000o''u0000p''u0000 ''u0000C''u0000S''u00004''u0000''u0000''u0000''u0001''u00008BIM''u0004''u0006''u0000''u0000''u0000''u0000''u0000''u0007''u0000''b''u0000''u0000''u0000''u0001''u0001''u0000??''u0010Chttp://ns.adobe.com/xap/1.0/''u0000<?xpacket begin='''???''' id='''W5M0MpCehiHzreSzNTczkc9d'''?>''r''n<x:xmpmeta xmlns:x='''adobe:ns:meta/''' x:xmptk='''Adobe XMP Core 4.2.2-c063 53.352624, 2008/07/30-18:12:18 '''>''r''n''t<rdf:RDF xmlns:rdf='''http://www.w3.org/1999/02/22-rdf-syntax-ns#'''>''r''n''t''t<rdf:Description rdf:about=''''' xmlns:xmp='''http://ns.adobe.com/xap/1.0/''' xmlns:dc='''http://purl.org/dc/elements/1.1/''' xmlns:photoshop='''http://ns.adobe.com/photoshop/1.0/''' xmlns:xmpMM='''http://ns.adobe.com/xap/1.0/mm/''' xmlns:stEvt='''http://ns.adobe.com/xap/1.0/sType/ResourceEvent#''' xmlns:tiff='''http://ns.adobe.com/tiff/1.0/''' xmlns:exif='''http://ns.adobe.com/exif/1.0/''' xmp:CreatorTool='''Adobe Photoshop CS4 Windows''' xmp:CreateDate='''2011-03-09T17:09:27+01:00''' xmp:ModifyDate='''2011-03-09T17:10:23+01:00''' xmp:MetadataDate='''2011-03-09T17:10:23+01:00''' dc:format='''image/jpeg''' photoshop:ColorMode='''3''' xmpMM:InstanceID='''xmp.iid:C525B6FA3E4AE01195AFE2861A054AE9''' xmpMM:DocumentID='''xmp.did:C525B6FA3E4AE01195AFE2861A054AE9''' xmpMM:OriginalDocumentID='''xmp.did:C525B6FA3E4AE01195AFE2861A054AE9''' tiff:Orientation='''1''' tiff:XResolution='''3000000/10000''' tiff:YResolution='''3000000/10000''' tiff:ResolutionUnit='''2''' tiff:NativeDigest='''256,257,258,259,262,274,277,284,530,531,282,283,296,301,318,319,529,532,306,270,271,272,305,315,33432;DE7B977DF6EFF346F11FF6BE697281C5''' exif:PixelXDimension='''200''' exif:PixelYDimension='''45''' exif:ColorSpace='''65535''' exif:NativeDigest='''36864,40960,40961,37121,37122,40962,40963,37510,40964,36867,36868,33434,33437,34850,34852,34855,34856,37377,37378,37379,37380,37381,37382,37383,37384,37385,37386,37396,41483,41484,41486,41487,41488,41492,41493,41495,41728,41729,41730,41985,41986,41987,41988,41989,41990,41991,41992,41993,41994,41995,41996,42016,0,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,20,22,23,24,25,26,27,28,30;0E127CF2EACEDA719CA574253BD56212'''>''r''n''t''t''t<xmpMM:History>''r''n''t''t''t''t<rdf:Seq>''r''n''t''t''t''t''t<rdf:li stEvt:action='''created''' stEvt:instanceID='''xmp.iid:C525B6FA3E4AE01195AFE2861A054AE9''' stEvt:when='''2011-03-09T17:10:23+01:00''' stEvt:softwareAgent='''Adobe Photoshop CS4 Windows'''/>''r''n''t''t''t''t</rdf:Seq>''r''n''t''t''t</xmpMM:History>''r''n''t''t</rdf:Description>''r''n''t</rdf:RDF>''r''n</x:xmpmeta>''r''n ''n o''u000bP????''u0006??T??/w?''u0000''u0007[???????', 'MailTechnician': 'email@email.it', 'WbsTechnician': 'xyz', 'NumberPincerTechnician': '' }
和下面的代码
using (StreamReader file = File.OpenText(@"path''file.json"))
{
JsonSerializer serializer = new JsonSerializer();
tbl_tech tech = (tbl_tech)serializer.Deserialize(file, typeof(tbl_tech));
}
这是我使用的对象
public partial class tbl_tech
{
public tbl_tech()
{
this.tbl_odl = new HashSet<tbl_odl>();
this.tbl_pdr = new HashSet<tbl_pdr>();
}
public long IdTechnician { get; set; }
public string DescTechnician { get; set; }
public string LoginTechnician { get; set; }
public string TelephoneTechnician { get; set; }
public string SignatureTechnician { get; set; }
public string MailTechnician { get; set; }
public string WbsTechnician { get; set; }
public string NumberPincerTechnician { get; set; }
public Nullable<long> TypeTechnician { get; set; }
public virtual ICollection<tbl_odl> tbl_odl { get; set; }
public virtual ICollection<tbl_pdr> tbl_pdr { get; set; }
}
,这是visual studio生成的错误。
{"无法从系统强制转换或转换。startservice .tbl_tech的字符串。"}
我不明白的是,对象的字段是完全相同的那些我的对象,所以在哪里错误的赋值给json ?我有什么问题吗?由于
json是一个对象数组,而不是一个对象。看到开头/结尾的[
和]
了吗?
tbl_tech[] tech = (tbl_tech[])serializer.Deserialize(sr, typeof(tbl_tech[]));
如果我像这样修改代码:
public partial class tbl_tech
{
public tbl_tech()
{
//this.tbl_odl = new HashSet<tbl_odl>();
//this.tbl_pdr = new HashSet<tbl_pdr>();
}
public long IdTechnician { get; set; }
public string DescTechnician { get; set; }
public string LoginTechnician { get; set; }
public string TelephoneTechnician { get; set; }
public string SignatureTechnician { get; set; }
public string MailTechnician { get; set; }
public string WbsTechnician { get; set; }
public string NumberPincerTechnician { get; set; }
public Nullable<long> TypeTechnician { get; set; }
//public virtual ICollection<tbl_odl> tbl_odl { get; set; }
//public virtual ICollection<tbl_pdr> tbl_pdr { get; set; }
}
deserialization
工作正常。因为现在你的json
和Type
是相似的
在创建JSon表示时尝试使用json2sharp。
我也从数字中去掉了"'":
[{'IdTechnician': 4, 'DescTechnician': 'Surname Name', 'LoginTechnician': 'name', 'TypeTechnician': 1, 'TelephoneTechnician': '+123456789', 'SignatureTechnician': 'signaturepath', 'MailTechnician': 'email@email.com', 'WbsTechnician': 'XYZ', 'NumberPincerTechnician': 1}]
给出如下模型:
public class RootObject
{
public int IdTechnician { get; set; }
public string DescTechnician { get; set; }
public string LoginTechnician { get; set; }
public int TypeTechnician { get; set; }
public string TelephoneTechnician { get; set; }
public string SignatureTechnician { get; set; }
public string MailTechnician { get; set; }
public string WbsTechnician { get; set; }
public int NumberPincerTechnician { get; set; }
}
你可以用下面的方法反序列化它:
IList<RootObject> result = new List<RootObject>();
using (StreamReader file = File.OpenText(@"path''file.json"))
{
result = JsonConvert.DeserializeObject<List<RootObject>>(file.ReadToEnd());
}