JSON check if a Child exsist in an Array

28 views
Skip to first unread message

str...@gmail.com

unread,
Jan 24, 2013, 11:51:26 AM1/24/13
to excel-r...@googlegroups.com
First thanks a lot for the JSON implementation in Excel.
I sucessfully conect to my web-service and parse the JSON string into VBA.

I did a lot with looping thru the arrays but now I wonder if there is a possibilty to check if a child exsist ?

for example in the array family the sub array kids only show up if there are kids.
so looping the family array and have a short statment like
if jo.child("kids").exsist = true then

I tried but failed.
Any suggestion how to address this.
Looping thru all keys with a big select Case statement I don't like.

Bruce Mcpherson

unread,
Jan 24, 2013, 12:45:15 PM1/24/13
to excel-r...@googlegroups.com
Not sure if you mean any children or a specific child .. here's both

if not jo.childExists("somename") is nothing then




--
 
 

Bruce Mcpherson

unread,
Jan 24, 2013, 12:46:34 PM1/24/13
to excel-r...@googlegroups.com
On 24 January 2013 17:45, Bruce Mcpherson <br...@mcpher.com> wrote:
Not sure if you mean any children or a specific child .. here's both

if not jo.childExists("somename") is nothing then
        it exists....


or 

  if jo.hasChildren then
     .. there are children


bruce 


Stephan Streck

unread,
Jan 24, 2013, 2:29:22 PM1/24/13
to excel-r...@googlegroups.com
Perfect.
Exactly the the "if not ... is nothing" statement I was looking for.
Thx


2013/1/24 Bruce Mcpherson <br...@mcpher.com>

--
 
 

Reply all
Reply to author
Forward
0 new messages