C# modern UI에서이 작업을 수행하려면 어떻게해야합니까?C#에서 System.Web.Script.Serialization을 어떻게 수행 할 수 있습니까?
var url = "http://ajax.googleapis.com/ajax/services/feed/load?q=http%3A%2F%2Fwww.digg.com%2Frss%2Findex.xml&v=1.0";
var wc = new WebClient();
var rawFeedData = wc.DownloadString(url);
//You can use System.Web.Script.Serialization if you don't want to use Json.NET
JavaScriptSerializer ser = new JavaScriptSerializer();
FeedApiResult foo = ser.Deserialize<FeedApiResult>(rawFeedData);
//Json.NET also return you the same strong typed object
var apiResult = JsonConvert.DeserializeObject<FeedApiResult>(rawFeedData);
그것은 나를 웹 클라이언트에서 오류를 오류 및 System.Web.Script.Serialization
무엇이 오류입니까? –
1. 형식 또는 네임 스페이스 이름 "WebClient"을 (를) 찾을 수 없습니다. 2. 형식 또는 네임 스페이스 이름 "JavaScriptSerializer"를 찾을 수 없습니다. – tovaz
[ClassLibrary에서 JSON 직렬화를 참조하는 방법] (http://stackoverflow.com)/questions/3872734/how-to-reference-json-serialization-in-classlibrary) – RajeshKdev