miércoles, 27 de febrero de 2013

Convertir String a un Objeto JSON ASP .NET



        Dim Jsonstring As New StringBuilder
        Dim js As New JavaScriptSerializer

        Jsonstring.Append("{")
        Jsonstring.Append(" ""Autor"": """ & TextBoxBAutor.Text.Trim & """, ")
        Jsonstring.Append(" ""Titulo"": """ & TextBoxBTitulo.Text.Trim & """, ")
        Jsonstring.Append(" ""Editorial"": """ & TextBoxBEditorial.Text.Trim & """, ")
        Jsonstring.Append(" ""Ano"": """ & TextBoxBAnno.Text.Trim & """, ")
        Jsonstring.Append(" ""Num"": """ & TextboxBNum.Text.Trim & """ ")
        Jsonstring.Append("}")


        TextBoxBiBlioDetalle.Text = Jsonstring.ToString()

        Dim _item As ListDictionary = js.Deserialize(Of ListDictionary)(Jsonstring.ToString)

        MsgBox(_item.Item("Autor").ToString)

No hay comentarios:

Publicar un comentario

Comenta :