c# - Exception deserialize JSON to an object with special charters -


i using code below deserialize json object, working should, if json containing special charters, throws error. how can make code can handle special charters? if use uft-8 encoding, isn't throwing errors, special charters not right.

 public static t convertjsontoobject<t>(string json)     {         datacontractjsonserializer js = new datacontractjsonserializer(typeof(t));         memorystream ms = new memorystream(system.text.encoding.getencoding("iso-8859-1").getbytes(json));          t response = (t)js.readobject(ms);         ms.close();         return response;     } 

thanks in advance.

thanks replies!

i found soloution using newtonsoft.json (jsonconvert.deserializeobject(json))


Comments