I was looking for an API in boost :: property_tree (which is used to read json) that I can use to determine if a field value is a tree or a terminal value. For example, I have json where the value of foo can be either a tree, as shown in the first block or a string, as shown in the second block.
{
"foo": {
" n1": "v1",
"n2": "v2"
}
}
{
"foo": "bar"
}
I know that we can check get_child_optional first. If the return value is null, we can check get_optional. But are there any better ways / apis for this?
source
share