C# 如何使用unicode字符获取json结果
如何在编码中从json中获取unicode值C# 如何使用unicode字符获取json结果,c#,json,C#,Json,如何在编码中从json中获取unicode值 string url = "https://www.googleapis.com/books/v1/volumes?q=isbn:9789753425988"; WebClient wc = new WebClient(); string GoogleBook = (wc.DownloadString(url)); GoogleBook = GoogleBook.Replace("\n", string.Empty); GoogleBookRespo
string url = "https://www.googleapis.com/books/v1/volumes?q=isbn:9789753425988";
WebClient wc = new WebClient();
string GoogleBook = (wc.DownloadString(url));
GoogleBook = GoogleBook.Replace("\n", string.Empty);
GoogleBookRespons book = JsonConvert.DeserializeObject<GoogleBookRespons>(GoogleBook);
List<BookSearchResult> Results = new List<BookSearchResult>();
public class GoogleBookRespons
{
public string kind { get; set; }
public int totalItems { get; set; }
public List<Item> items { get; set; }
}
public class BookSearchResult
{
public string ISBN { get; set; }
public string Title { get; set; }
public List<string> Author { get; set; }
public string Published { get; set; }
public string Imagelink { get; set; }
public string Image { get; set; }
}
stringurl=”https://www.googleapis.com/books/v1/volumes?q=isbn:9789753425988";
WebClient wc=新的WebClient();
字符串GoogleBook=(wc.DownloadString(url));
GoogleBook=GoogleBook.Replace(“\n”,string.Empty);
GoogleBookResponse book=JsonConvert.DeserializeObject(GoogleBook);
列表结果=新列表();
公共类GoogleBookResponse
{
公共字符串种类{get;set;}
公共整数totalItems{get;set;}
公共列表项{get;set;}
}
公共类图书搜索结果
{
公共字符串ISBN{get;set;}
公共字符串标题{get;set;}
公共列表作者{get;set;}
已发布的公共字符串{get;set;}
公共字符串Imagelink{get;set;}
公共字符串图像{get;set;}
}
显示结果:Yüzüklerin Efendisi 1 Yüzük
但我想将其显示为:Yüzüklerin Efendisi Yüzük将WebClient编码属性设置为UTF-8 像这样:
wc.Encoding = System.Text.Encoding.UTF8;
它应该可以工作。您可以发布item以及item使用的任何其他类吗?