Hi all
I am investigating the use of Chilkat's tools for parsing JSON objects but I am
having trouble developing a generic routine. For example, take the following:
Local loJsonObject As 'Chilkat_9_5_0.JsonObject'
Local lcStrJsonObject, lnNumPets
lcStrJsonObject =
'{"pets":[{"name":"jack","breed":"terrier"},{"name":"john","breed":"bulldog"},{"name":"joe","breed":"terrier"}]}'
loJsonObject = CreateObject('Chilkat_9_5_0.JsonObject')
loJsonObject.Load(lcStrJsonObject)
i = 0
lnNumPets = loJsonObject.SizeOfArray("pets")
DO WHILE i < lnNumPets
loJsonObject.I = i
? STR(i) + ": " + loJsonObject.StringOf("pets[i].name") + "," +
loJsonObject.StringOf("pets[i].breed")
i = i + 1
ENDDO
What I am trying to do is make the code generic such that I do not need to
refer to "pets", "name" and "breed". Any help would be much appreciated. I
have found a generic method for parsing JSON arrays but so far have been unable
to do so for JSON objects
Paul Newton
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/mn2pr02mb59208f42d3af7c76708318c2a1...@mn2pr02mb5920.namprd02.prod.outlook.com
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.