Skip to content
JsonBlock

GetNumElements

std::size_t GetNumElements() const

Will return the number of elements in this JsonBlock.


Example:

Json:
{
    "hat": true,
    "height": 22
}
C++:
myJsonBlock.GetNumElements() // returns 2

Json:
{
    "kids": [
        "Stewie",
        "Chris",
        "Megatron"
    ],
    "pers_info": {
        "name": "Peter",
        "age": 56
    }
}
C++:
myJsonBlock.GetNumElements() // returns 2

This does still return 2, because this JsonBlock only has two elements. kids and pers_info.