1
我正在嘗試使用Bing api。問題是我不斷收到「解析值時遇到意外字符:<。路徑',第0行,位置0」錯誤。具體在JObject.Parse解析值<時遇到意外的字符。路徑'',第0行,位置0
這裏是我的代碼:
public async Task<CoordServiceResult> LookUp()
{
var result = new CoordServiceResult();
var location = "seattle";
var key = "MyBingKey"
var url = "http://dev.virtualearth.net/REST/v1/Locations?q=" + location + "&output=xml&key=" + key;
var client = new HttpClient();
var json = await client.GetStringAsync(url);
var results = JObject.Parse(json);
var resources = results["resourceSet"][0]["resources"];
var coords = resources[0]["geocodePoints"][0]["coordinates"];
result.Lat = (double)coords[0];
result.Long = (double)coords[1];
return result;
}
我也看着這個鏈接Error Parsing Json但它沒有工作,要麼。有什麼建議麼?
謝謝