public class keywords
{
[JsonProperty(PropertyName = "text")]
public string text { get; set; }
[JsonProperty(PropertyName = "relevance")]
public string relevance { get; set; }
}
public class JsonData
{
[JsonProperty(PropertyName = "status")]
public string status { get; set; }
[JsonProperty(PropertyName = "usage")]
public string usage { get; set; }
[JsonProperty(PropertyName = "url")]
public string url { get; set; }
[JsonProperty(PropertyName = "language")]
public string language { get; set; }
[JsonProperty ("keywords")]
public keywords keyword { get; set; }
}
上記は、alchemy API を呼び出して受信した json 応答を逆シリアル化するために使用しているクラスです。
string url = "https://alchemy.p.mashape.com/Text/TextGetRankedKeywords?outputMode=json&text=" + text;
var response = (Unirest.get("https://alchemy.p.mashape.com/Text/TextGetRankedKeywords?outputMode=json&text=" + text)
.header("X-Mashape-Key", "AlZVYH30C9mshLPNM7KiE48aFfTHp1h3A31jsnmVPccxBzW5uB")
.header("Accept", "application/json")
.asJson<JsonData>()
.Body);
var status = response.keyword.text;
var score = response.keyword.relevance;
このエラーが発生しています:
タイプ 'Newtonsoft.Json.JsonReaderException' の例外が Newtonsoft.Json.dll で発生しましたが、ユーザー コードで処理されませんでした
追加情報: 値の解析中に予期しない文字が検出されました: <。パス ''、行 0、位置 0。