使用招來觀察這個網址: http://opencaselist.paperlessdebate.com/bin/AllDocs?view=attachments#format=json?|t=allattachments&p=1&l=10&s=filename&d=asc獲取JSON字符串的HTTP GET請求
我找到這樣
我如何得到這個響應轉換成字符串,我可以節省一筆可觀的JSON響應在一個txt文件中使用C#?有沒有辦法將HTTP Web Response轉換爲字符串?有什麼可以幫助我的NewtonSoft JSON?有沒有特別的條款可以幫助我更有效地谷歌?
每次我嘗試我只是在鏈接獲取網頁的HTML版本,而不是JSON數據,我試圖讓:
string url = "http://opencaselist.paperlessdebate.com/bin/AllDocs?view=attachments#|t=allattachments&p=1&l=10&s=filename&d=asc";
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(url);
httpWebRequest.Method = WebRequestMethods.Http.Get;
httpWebRequest.Accept = "text/json";
httpWebRequest = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse response = (HttpWebResponse)httpWebRequest.GetResponse();
response.Close();
看看這個鏈接http://stackoverflow.com/questions/2108297/how-to-get-json-response-using-system-net-webrequest-in-c – Goose