How to read field type from boost property tree

I use boost property trees to read values โ€‹โ€‹from a json file.

{
    "some_values":
    {
        "field_1":  "value_1",
        "field_2":  true
    }
}

I can read the values โ€‹โ€‹with:

spTree->get<string>("some_values.field_1",  "");
spTree->get<bool>("some_values.field_2",    false);

But can I read the type of the variable stored in any given field?

+4
source share
1 answer

Documentation says

[...] the following JSON / property tree mapping is used:

[...] JSON , . ; , "null", "true" "false" . , , , .

, JSON, .

+4

Source: https://habr.com/ru/post/1668234/


All Articles