Ajudando um amigo aqui no trabalho a serializar um Objeto Java em Json, fiquei curioso em saber como seria em AspNet. Segue exemplo.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim serializar As JavaScriptSerializer = New JavaScriptSerializer()
Dim pessoa As IList(Of Pessoa) = New List(Of Pessoa)
For x As Integer = 0 To 5
Dim p As New Pessoa
p.Idade = 10
p.Nome = "Felipe " & x
pessoa.Add(p)
Next
TextBox1.Text = serializar.Serialize(pessoa).ToString()
End Sub
Public Class Pessoa
Private _idade As String
Private _nome As String
Public Property Idade() As String
Get
Return _idade
End Get
Set(ByVal value As String)
_idade = value
End Set
End Property
Public Property Nome() As String
Get
Return _nome
End Get
Set(ByVal value As String)
_nome = value
End Set
End Property
'*** Construtor
'Public Sub New(ByVal nome, ByVal idade)
' _idade = idade
' _nome = nome
'End Sub
End Class