Skip to content

Instantly share code, notes, and snippets.

@atifaziz
Forked from anonymous/test.vb
Created August 13, 2008 16:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atifaziz/5249 to your computer and use it in GitHub Desktop.
Save atifaziz/5249 to your computer and use it in GitHub Desktop.
{
"logon": "john@fakesite.com",
"addresses": [
{
"shippingAddressCount":"2",
"shipping": [
{
"firstName": "John",
"lastName": "Smith",
"address1": "111 Fake St.",
"address2": "",
"city": "New York",
"state": "NY",
"zip": "11111"
},
{
"firstName": "John",
"lastName": "Smith",
"address1": "222 Fake St.",
"address2": "",
"city": "New York",
"state": "NY",
"zip": "11111"
}
],
"billing": {
"firstName": "John",
"lastName": "Smith",
"address1": "111 Fake St.",
"address2": "",
"city": "New York",
"state": "NY",
"zip": "11111"
},
"marketing": {
"addressId": "12345",
"firstName": "John",
"lastName": "Smith",
"address1": "111 Fake St.",
"address2": "",
"city": "New York",
"state": "NY",
"zip": "11111",
}
}
]
}
' Test code for thread:
' http://groups.google.com/group/jayrock/t/936408c0b8034d83
Imports System.IO
Imports System.Collections
Imports Jayrock.Json.Conversion
Module MainModule
Sub Main()
Dim root As IDictionary = JsonConvert.Import(File.ReadAllText("json.txt"))
Dim logon As String = root("logon")
Console.WriteLine("logon: " & logon)
Dim addresses As IList = root("addresses")
For Each address As IDictionary In addresses
For Each shipping As IDictionary In address("shipping")
Console.WriteLine()
Dump(shipping, Console.Out)
Next
Console.WriteLine()
Dump(address("billing"), Console.Out)
Next
End Sub
Sub Dump(ByVal address As IDictionary, ByVal output As TextWriter)
output.WriteLine("firstName: " & address("firstName"))
output.WriteLine("lastName : " & address("lastName"))
output.WriteLine("address1 : " & address("address1"))
output.WriteLine("address2 : " & address("address2"))
output.WriteLine("city : " & address("city"))
output.WriteLine("state : " & address("state"))
output.WriteLine("zip : " & address("zip"))
End Sub
End Module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment