0

私はいくつかのjsonデータを持っています。それをプレーンテキストに変換したいのですが、以下はJSONで取得しているコンテンツです

{"items":[{"id":1371503932001,"name":"shure_ksm_mics","adKeys":null,"shortDescription":"shure_ksm_mics","longDescription":null,"creationDate":"1325934831982","publishedDate":"1325934831982","lastModifiedDate":"1325937858839","linkURL":null,"linkText":null,"tags":[],"videoStillURL":null,"thumbnailURL":null,"referenceId":null,"length":204130,"economics":"AD_SUPPORTED","playsTotal":null,"playsTrailingWeek":null,"FLVURL":"rtmp:\/\/brightcove.fcod.llnwd.net\/a500\/d19\/&media\/13421268001\/13421268001_1371835938001_shure-ksm-mics&1325955600000&1818a465ec2632081e214f18376d6a4d","renditions":[],"FLVFullLength":{"audioOnly":false,"controllerType":"DEFAULT","displayName":"shure_ksm_mics.flv","encodingRate":1000000,"frameHeight":480,"frameWidth":640,"id":1371835938001,"referenceId":null,"remoteStreamName":null,"remoteUrl":null,"size":29068243,"uploadTimestampMillis":1325934831973,"url":"rtmp:\/\/brightcove.fcod.llnwd.net\/a500\/d19\/&media\/13421268001\/13421268001_1371835938001_shure-ksm-mics&1325955600000&1818a465ec2632081e214f18376d6a4d","videoCodec":"ON2","videoContainer":"FLV","videoDuration":204130},"videoFullLength":{"audioOnly":false,"controllerType":"DEFAULT","displayName":"shure_ksm_mics.flv","encodingRate":1000000,"frameHeight":480,"frameWidth":640,"id":1371835938001,"referenceId":null,"remoteStreamName":null,"remoteUrl":null,"size":29068243,"uploadTimestampMillis":1325934831973,"url":"rtmp:\/\/brightcove.fcod.llnwd.net\/a500\/d19\/&media\/13421268001\/13421268001_1371835938001_shure-ksm-mics&1325955600000&1818a465ec2632081e214f18376d6a4d","videoCodec":"ON2","videoContainer":"FLV","videoDuration":204130}}],"page_number":0,"page_size":100,"total_count":-1}

私は以下のクラスを作成しました

public class VideoList
{
    public VideoList() { }
    private string _name;
    public string Name
    {
        get
        {
            return _name;
        }
        set 
        {
            value = _name;
        }
    }
}

現在、名前を取得したいだけです。System.Web.Script.Serialization.JavacriptSerializer クラスを使用してこれを行う方法。

4

1 に答える 1

0

モデル構造を変更しましたが、これでうまくいくはずです:

var serializer = new JavaScriptSerializer();
var result = serializer.Deserialize<VideoList>(json);

public class VideoList
{
    public List<Video> Items { get; set; }
}

public class Video
{
    public string Name { get; set;}

    // you can extend this class with additional propertie
    // to get the rest of json data
}
于 2012-01-07T15:38:53.917 に答える