Created
June 24, 2013 22:32
-
-
Save AlexArchive/5854294 to your computer and use it in GitHub Desktop.
Basic JavaScriptSerializer Deserialize example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Imports System.Web.Script.Serialization | |
Module Program | |
Sub Main() | |
Const jsonResponse = "{""a"":1,""b"":2,""c"":3,""d"":4,""e"":5}" | |
Dim serializer As New JavaScriptSerializer() | |
Dim response As Response = serializer.Deserialize(Of Response)(jsonResponse) | |
Console.WriteLine("A: {0}", response.A) | |
Console.WriteLine("B: {0}", response.B) | |
Console.WriteLine("C: {0}", response.C) | |
Console.WriteLine("D: {0}", response.D) | |
Console.WriteLine("E: {0}", response.E) | |
Console.WriteLine() | |
Console.WriteLine("Press Any Key To Continue...") | |
Console.ReadKey() | |
End Sub | |
End Module | |
Public Class Response | |
Public A As Integer | |
Public B As Integer | |
Public C As Integer | |
Public D As Integer | |
Public E As Integer | |
End Class |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment