nlohmann json:通过at读取及设置object和array

 读取及设置:

#include 
#include 
using namespace std;
using json = nlohmann::json;

int main()
{
    json data = R"({
        "name": "xiaoming",
        "age": 10, 
        "parent":   
        [
            {
                "father" : "zhang",
                "age" : 40
            },
            {
                "mother" : "wang",
                "age" : 36
            }
        ]
    })"_json;

    cout<

运行程序输出:

"xiaoming"
40
{"age":10,"name&

你可能感兴趣的:(C/C++,json)