首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在ASP中构建JSON,我不知道如何在Json.net或JavaScriptSerializer中构建此部分

在ASP中构建JSON,我不知道如何在Json.net或JavaScriptSerializer中构建此部分
EN

Stack Overflow用户
提问于 2012-08-10 04:35:39
回答 1查看 110关注 0票数 0

所有人!

我正在构建JSON,但我不确定如何构建JSON的这一部分。

代码语言:javascript
运行
复制
'playlist': [
        {
           'file': 'bunny.mp4',
           'title': 'Big Buck Bunny Trailer',
           'provder': 'rtmp',
           'streamer': 'rtmp://rtmp.server.com/application',
           'image': 'http://thumbnails.server.com/thumbs/bunny.jpg',
           'duration': '33.03',
           'description': 'An animated short from the Blender project'
        },
        {
           'file': 'sintel.mp4',
           'title': 'Sintel',
           'streamer': 'rtmp://rtmp.server.com/application',
           'image': 'http://thumbnails.server.com/thumbs/sintel.jpg',
           'provider': 'rtmp',
           'duration': '888.06',
           'description': 'An animated short from the Blender project'
        },
        {
           'file': 'elephant.mp4a',
           'title': 'Elephant´s Dream',
           'streamer': 'rtmp://rtmp.server.com/application',
           'image': 'http://thumbnails.server.com/thumbs/elephant.jpg',
           'provider': 'rtmp',
           'duration': '653.79',
           'description': 'An animated short from the Blender project'
        }
    ]

我可以做播放列表部分,但我不确定这三个子部分。

完整的json如下所示

代码语言:javascript
运行
复制
{
    'flashplayer': 'player.swf',
    'id': 'playerID',
    'width': '650',
    'height': '240',
    'playlist.position': 'right',
    'playlist.size': '250',
    'playlist': [
        {
           'file': 'bunny.mp4',
           'title': 'Big Buck Bunny Trailer',
           'provder': 'rtmp',
           'streamer': 'rtmp://rtmp.server.com/application',
           'image': 'http://thumbnails.server.com/thumbs/bunny.jpg',
           'duration': '33.03',
           'description': 'An animated short from the Blender project'
        },
        {
           'file': 'sintel.mp4',
           'title': 'Sintel',
           'streamer': 'rtmp://rtmp.server.com/application',
           'image': 'http://thumbnails.server.com/thumbs/sintel.jpg',
           'provider': 'rtmp',
           'duration': '888.06',
           'description': 'An animated short from the Blender project'
        },
        {
           'file': 'elephant.mp4a',
           'title': 'Elephant´s Dream',
           'streamer': 'rtmp://rtmp.server.com/application',
           'image': 'http://thumbnails.server.com/thumbs/elephant.jpg',
           'provider': 'rtmp',
           'duration': '653.79',
           'description': 'An animated short from the Blender project'
        }
    ]
  }

除了播放列表中的项目之外,我可以做任何事情。我之前使用了一个字典对象,只是调用(JavaScriptSerializer) serializer.Serialize(ConfigurationDictionary)将其转换为我想要的JSON。

有没有办法在播放列表部分中得到我想要的结果?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-08-10 04:48:47

将'playlist‘属性设置为包含所列属性(文件、标题、流、图像、提供商、持续时间、描述)的歌曲或曲目对象的数组或列表

代码语言:javascript
运行
复制
Public Class Track
 Public Property file as String
 Public Property title as String 
 (etc)
End Class

Public Class Playlist
 Public Property flashplayer As String
 (etc)
 Public Property playlist As List(Of Track)
End Class

然后,您可以只使用JSON库或函数。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11891538

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档