我正在尝试阅读 Rest Web API 响应。解析数据时出现错误
响应内容类型:application/json;字符集=utf-8
响应:{"access_token":"ot-a4943ac25cf94df3adacd11c71b8ea01","token_type":"Bearer","scope":["READ_USER_PROFILE","WRITE_CONVERSATIONS","READ_CONVERSATIONS"]}
DTO:
public class ResponseData
{
public string AccessToken { get; set; }
public string TokenType { get; set; }
public string Scope { get; set; }
}
public class Scope
{
public string[] RequestScope { get; set; }
}
代码:
using (HttpContent rescontent = response.Result.Content)
{
// ... Read the string.
Task<string> result = rescontent.ReadAsStringAsync();
// res = result.Result;
var responseData = JsonConvert.DeserializeObject<ResponseData>(result.Result);
Console.WriteLine("Response: {0}", responseData.AccessToken);
}
错误:Newtonsoft.Json.JsonReaderException:'解析值时遇到意外字符:[。路径“范围”,第 1 行,位置 85。
编程语言:C#
请告诉我,如何纠正这个问题?我想从响应中读取访问令牌参数。