I want to know if a Value of a JsonItem is an array:
and it is clear that this particular one isn’t:
but why am I getting an error, when I just want to have a returned false? I mean, it knows that it’s not an array obviously? Do I really have to try/catch this situation?
What’s the JSON behind the Ji JSONItem? What actually is in Value(i)?
It fails at “specification”
[
{
"art_eb1":"",
"art_eb2":"",
"attribute":"Kindersitz | im Rollstuhl",
"bemerkung_eb":"",
"eltern_mobil":"234234234234234",
"eltern_mobil2":"432432",
"eltern_telefon":"423424",
"eltern_vorname":"lalala",
"zweiter_vertreter":"False",
"spezification":{
}
}
]
The issue is that you are treating an object as if it were an array. You can’t access items in an object by index, only by name.
Try:
if Ji.Value( Ji.KeyAt( i ) ).IsArray then ...
DerkJ
(DerkJ)
July 21, 2022, 1:06pm
5
If JI is the {} object within the root arry:
if Ji.Child("spezification").isArray Then
// Child returns a JSONItem
// Value returns a variant
end if