How to parse json file with std::optional< std::variant > type in C++?
问题 How can I parse nested json in c++? I am looking for a json parser that is capable of parsing nested json. Especially this field in the example json below: optional<variant<bool, Secondary>> secondary; It is type composition of optional and variant . Though only the full example can surface the problem in a clearer way, a minimal starting point example would be this one: [ {}, { "secondary": false }, { "secondary": { "chance": 10, "boosts": { "spd": -1 } } }, { "secondary": { "chance": 30,