NET and im trying to create a JSON output like this
{
"data": [{
"title": "blah",
"youtube_videos": {
"video_identifier": [
{
"video_identifier": "id1"
},
"video_identifier": "id2"
}]
etc.
n "news" with n "videos" associated
And this is my code so far:
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})
I dont know how to cointinue to add all the videos to each new
Any help would be apreciated. Thanks you.