解析值时遇到意外的字符:<。路径'',第0行,位置0.同时通过mashape调用alchemy api

时间:2015-08-17 13:22:20

标签: c# .net json api alchemy

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; }     
}

上面是我用来通过调用炼金术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;

我收到此错误:

  

类型&#39; Newtonsoft.Json.JsonReaderException&#39;的例外情况发生在Newtonsoft.Json.dll但未在用户代码中处理

     

其他信息:解析值时遇到意外的字符:&lt;。路径&#39;&#39;,第0行,第0位。

0 个答案:

没有答案