I have a deep nested JSON data model with a lot of optional keys and optional sub- structures.
When trying to read a non-existing optional key in a not yet existing path the library silently creates this path. When parts of the branch are not existing 'null' keys / 'null' structures are silently generated into the JSON model.
Even checking for a key generates the elements on its path:
...
if (jm["Elements"]["Comments"].contains("Comment")
{ /* Key is existing */
bOk = !FALSE;
}
...
This generates following JSON output:
{
"Elements": {
"Comments": null
}
}
I tried also the 'find' method with the same result. Addressing a non-existing key generates it.
To check each sub-level with 'contain' or 'find' before accessing the next sub-key is not a real option
because the nesting depth is 10 and the model contains a few thousand 1000 optional keys.
Is there any hint how to check if a key exists without checking each key on its path?
Any help is welcome
Christian
I have a deep nested JSON data model with a lot of optional keys and optional sub- structures.
When trying to read a non-existing optional key in a not yet existing path the library silently creates this path. When parts of the branch are not existing 'null' keys / 'null' structures are silently generated into the JSON model.
Even checking for a key generates the elements on its path:
This generates following JSON output:
I tried also the 'find' method with the same result. Addressing a non-existing key generates it.
To check each sub-level with 'contain' or 'find' before accessing the next sub-key is not a real option
because the nesting depth is 10 and the model contains a few thousand 1000 optional keys.
Is there any hint how to check if a key exists without checking each key on its path?
Any help is welcome
Christian