i'm reading Json from a web api, with Newtonsoft.Json
most of their page are fine.
But some of them may contain some special character which fail my parsing.
Code is like:
WebClient client = new WebClient();
String strJson = client.DownloadString(url);
JObject jObject = JObject.Parse(strJson );
then i try to convert to UTF8 it still no work:
WebClient client = new WebClient();
String strJson = client.DownloadString(url);
byte[] utf8Bytes = Encoding.UTF8.GetBytes(strJson);
string safeJsonStr= Encoding.UTF8.GetString(utf8Bytes);
JObject jObject = JObject.Parse(safeJsonStr);
please help!
thanks
well, finally i find a way.
i see there are some special language, and i feel i need a decode or encode.
then finally i find this works:
client.Encoding = System.Text.Encoding.UTF8;
strJson = client.DownloadString(url);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With