我有一些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}
{"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}
我创建了以下课程
目前我只想得到名字。 如何使用System.Web.Script.Serialization.JavacriptSerializer类。
答案 0 :(得分: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
}