Skip to content
JsonData

GetParent

JsonData& GetParent()
const JsonData& GetParent() const

Returns this JsonData's direct parent.

If this JsonData does not have a direct parent, it will throw a JsonNoParentAvailableException.
You can check this via HasParent().

What does this mean? In this example, the direct parent of age is personal_details.

{
    "personal_details": {
        "age": 17
    }
}

The same applies for arrays, like this:
The direct parent of the element with value "Lois" is names.

{
    "names": [
        "Peter",
        "Lois",
        "Brian",
        "Megatron"
    ]
}