Skip to content

Instantly share code, notes, and snippets.

Created August 12, 2008 15:35
Show Gist options
  • Save anonymous/5056 to your computer and use it in GitHub Desktop.
Save anonymous/5056 to your computer and use it in GitHub Desktop.
{
"logon": "[email protected]",
"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()
Console.WriteLine("firstName: " & shipping("firstName"))
Console.WriteLine("lastName : " & shipping("lastName"))
Console.WriteLine("address1 : " & shipping("address1"))
Console.WriteLine("address2 : " & shipping("address2"))
Console.WriteLine("city : " & shipping("city"))
Console.WriteLine("state : " & shipping("state"))
Console.WriteLine("zip : " & shipping("zip"))
Next
Next
End Sub
End Module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment