jsonObject question

Posted by goo on 13-Nov-2019 19:14

If I know there can be, but not mandatory, an jsonObject within an jsonObject, what is the correct way to check if it is there?

oObject:Has('') seems to check only properties.

I can get all names by oObject:GetNames() but is there an easy way of checking if it contains a spesific name without having to do a:

def var Names as longchar extent no-undo.

do i = 1 to extent(names):

  NameList = NameList + Names[i] + ','.

end.

NamesList = right-trim(NameList,',').

if index(NameLsit,'myObjectName') gt 0 then....

Posted by Mike Fechner on 13-Nov-2019 19:18

Try Has() again. Works for me.
 
The JsonObject Model is case-sensitive for all property names – including Object or Array properties.

All Replies

Posted by Mike Fechner on 13-Nov-2019 19:18

Try Has() again. Works for me.
 
The JsonObject Model is case-sensitive for all property names – including Object or Array properties.

Posted by goo on 13-Nov-2019 19:23

aaah, now I know that 11 hours work is a bit too much .... I checked again (because of your answar), and of course... it works.... thanks !

Posted by Peter Judge on 13-Nov-2019 21:26

FWIW I logged a doc bug so that the Has() and other JSON object methods indicate that proeprty names are case sensitive.
 

Posted by Mike Fechner on 13-Nov-2019 21:30

Thanks Peter - that will be helpful.

Even though I'm really surprised we agree on a question of case ;)

This thread is closed