【发布时间】:2015-06-11 18:18:10
【问题描述】:
我正在尝试通过url 以 JSON 格式请求 StackExchange 上的标签列表,但问题是,我得到了一些损坏的文本而不是 JSON,所以我什至无法解析它。
P.S.在 RestSharp 的帮助下完成。
private void Refresh()
{
var client = new RestClient("http://api.stackexchange.com/2.2/tags?order=desc&sort=popular&site=stackoverflow");
var result = client.Execute(new RestRequest(Method.GET));
var array = JsonConvert.DeserializeObject<Root>(result.Content);
Platforms = array.Platforms;
}
【问题讨论】:
-
请edit your question 并包含损坏的文本。
-
我不使用 c#,但我涉足了 stackexchange api,根据我的经验,响应是 gzip 编码的。使用我使用的 Java 客户端,我必须使用 gzip 解码器
-
当你找到答案时,不要破坏你的问题。请post an answer with your solution.
标签: c# json asp.net-mvc-5 stackexchange-api