解析值时遇到意外字符:c。路径 '',第 0 行,位置 0。
Unexpected character encountered while parsing value: c. Path '', line 0, position 0.
我知道之前有人问过这个问题,但我尝试了所有选项,但无法解决。我的代码是这样的
WebClient client = new WebClient();
string url = "https://demos.telerik.com/kendo-ui/service/StockData";
string EncryptedJson = client.DownloadString(url);
var dataresponse = (JObject)JsonConvert.DeserializeObject(EncryptedJson);
在 deserialzeObject 中抛出异常
Unexpected character encountered while parsing value: c. Path '', line
0, position 0.
而 client.DownloadString(url) 以下列格式提供数据
callback([{"Date":"/Date(1196467200000)/","Close":40.635,"Volume":1650185491,"Open":40.640,"High":40.680,"Low":39.090}])
那不是 JSON,是 JSONP。
去掉开头的callback(
和结尾的)
,得到JSON:
EncryptedJson = EncryptedJson.Substring(9, EncryptedJson.Length - 10);
我知道之前有人问过这个问题,但我尝试了所有选项,但无法解决。我的代码是这样的
WebClient client = new WebClient();
string url = "https://demos.telerik.com/kendo-ui/service/StockData";
string EncryptedJson = client.DownloadString(url);
var dataresponse = (JObject)JsonConvert.DeserializeObject(EncryptedJson);
在 deserialzeObject 中抛出异常
Unexpected character encountered while parsing value: c. Path '', line 0, position 0.
而 client.DownloadString(url) 以下列格式提供数据
callback([{"Date":"/Date(1196467200000)/","Close":40.635,"Volume":1650185491,"Open":40.640,"High":40.680,"Low":39.090}])
那不是 JSON,是 JSONP。
去掉开头的callback(
和结尾的)
,得到JSON:
EncryptedJson = EncryptedJson.Substring(9, EncryptedJson.Length - 10);