NET和IM试图建立这样序列化JSON嵌套与Json.net(VB.NET)
{
"data": [{
"title": "blah",
"youtube_videos": {
"video_identifier": [
{
"video_identifier": "id1"
},
"video_identifier": "id2"
}]
等
N “新闻” 与N “视频” 相关
一个JSON输出这是到目前为止我的代码:
Class News
Public Property title() As String
Get
Return _title
End Get
Set(value As String)
_title = value
End Set
End Property
Private _title As String
Public Property id() As String
Get
Return _sId
End Get
Set(value As String)
_sId = value
End Set
End Property
Private _youtube_videos As YoutubeVideos = New YoutubeVideos()
Public Property youtube_videos As YoutubeVideos
Get
Return _youtube_videos
End Get
Set(ByVal value As YoutubeVideos)
_youtube_videos = value
End Set
End Property
Ënd Class
Public Class YoutubeVideos
Private _video_identifier As String
Public Property video_identifier() As String
Get
Return _video_identifier
End Get
Set(ByVal value As String)
_video_identifier = value
End Set
End Property
End Class
...
Private Function getJSON(ByVal sJSON As String) As String
Dim objNews As New List(Of Noticia)
Dim objVideos As New List(Of YoutubeVideos)
Dim objItem As New News
objItem.title = "blah blah"
objNews .Add(objItem)
???
Return Newtonsoft.Json.JsonConvert.SerializeObject(New With {Key .data = objNews})
我不知道如何cointinue到的所有视频添加到每个新
任何帮助将apreciated。谢谢。
感谢您的回答,完美的作品:) –