2012-08-09 5 views
0

모두!ASP에서 JSON을 작성하기 위해 Json.net 또는 JavaScriptSerializer에서이 부분을 빌드하는 방법을 모르겠다.

JSON을 작성 중이며이 부분을 JSON으로 작성하는 방법을 모르겠습니다.

'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 내가 재생 목록에있는 항목 만 모든 것을 할 수있는이

{ 
    '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으로 바꿨습니다.

재생 목록 부분의 파트로 원하는 결과를 얻는 방법이 있습니까?

답변

1

'재생 목록'속성에 나열된 특성을 포함하는 배열이나 노래의 목록이나 트랙 개체 다음 (파일, 제목, 유영, 이미지, 제공, 기간, 설명)

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 라이브러리 또는 함수를 사용하십시오.

+0

감사합니다. 많은 도움이되었습니다. – Bombcode