You can determine whether the value is an object by using $IsObject(value) before processing it.
Alternatively, you can rely on the third argument of %GetNext(,,.type), which tells you the datatype of the value.
Example code
set iter = identifiers.%GetIterator()
while iter.%GetNext(.key, .value, .type) {
if $IsObject(value) {
set text = value.%Get("text")
}
}set iter = identifiers.%GetIterator()
while iter.%GetNext(.key, .value, .type) {
if type = "object" {
set text = value.%Get(key) ;for example value.%Get("text")
}
if type = "array" {
set text = value.%Get(index) ; for example: value.%Get(0)
}
}- Log in to post comments