Hi guys,

I am just starting to dabble in json and was hoping to get a little help. Using the following code, I am able to deserialize a simple json string and reference it's values:

Code:
'********************************************************************************************************************
Imports System.Web.Script.Serialization

Sub Main(ByVal Parm As Object)
Try
Dim JSONString As String = "{0:[{""name"":""Joe"",""age"":27},{""name"":""Hans"",""age"": 62}]}"
Dim j As Object = New JavaScriptSerializer().Deserialize(Of Object)(JSONString)

Dim a = j("0")(0)("name") ' Joe
Dim b = j("0")(0)("age") ' 27
Dim c = j("0")(1)("name") ' Joe
Dim d = j("0")(1)("age") ' 62

hs.writelog("a=", a)
hs.writelog("b=", b)
hs.writelog("c=", c)
hs.writelog("d=", d)

Catch ex As Exception : hs.writelog("Test Script", "Error: " & ex.Message.ToString)
End Try
End Sub
'********************************************************************************************************************
HS log output:
Sep-20 1:18:43 PM d= 62
Sep-20 1:18:43 PM c= Hans
Sep-20 1:18:43 PM b= 27
Sep-20 1:18:43 PM a= Joe
This works perfectly fine (although it took awhile to get to this point :-))

The question I have is that if I deserialize a much larger more complex JSON string using the same code into the object "j", is there a way to "discover" or browse through the contents of "j" without knowing how to reference each data element?

The reason for my question is that for complex multilevel JSON which has arrays, it would help to quickly get a better feel for how to reference the data elements. (I have done a fair amount of trial and error and also tried to read the documentation but it seems quite mind boggling at this point in time).

Any help appreciated.

Thanks

Dennis