나는 Json을 가지고, 내가 deserialize하고 클래스의 속성 안에 저장 싶어요. 하지만, 그 클래스를 사용하여 직렬화되지 않았 기억 JSON 데이터asp.net에서 Json Deserializing
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create("http://api.brightcove.com/services/library?command=find_playlist_by_id&token=myToken&playlist_id=61674080001&video_fields=id,name,thumbnailURL,playsTotal,shortDescription&page_size=1&sort_by=plays_total&sort_order=desc");
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
using (StreamReader reads = new StreamReader(response.GetResponseStream()))
{
value = reads.ReadToEnd();
}
value = value.Remove(1, value.IndexOf("]") + 1);
hidField.Value = value;
JavaScriptSerializer s = new JavaScriptSerializer();
BCVideos v = s.Deserialize<BCVideos>(value);
클래스 .. 가능이 클래스의 속성에 JSON 값을 저장한다.
public class BCVideos
{
private int _id;
public int Id
{
get { return _id; }
set { _id = value; }
}
private string _name, _thumbnailUrl, _shortDescription;
public string ShortDescription
{
get { return _shortDescription; }
set { _shortDescription = value; }
}
public string ThumbnailUrl
{
get { return _thumbnailUrl; }
set { _thumbnailUrl = value; }
}
public string Name
{
get { return _name; }
set { _name = value; }
}
}
누구든지 이런 종류의 작업을 수행 한 경우 회신하여주십시오.