You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
zhaohe df0a856557 修改默认日志配置 2 months ago
..
README.md recode 4 months ago
json.hpp recode 4 months ago

README.md

###使用教程和注意事项

1.解析


auto j3 = json::parse("{ \"happy\": true, \"pi\": 3.141 }");


2.读

Warning读会抛出异常 use function at() to access the object values rather than operator[]. In case a key does not exist, at throws an exception that you can handle, whereas operator[] exhibits undefined behavior. 使用方法at去读数值,而不是使用[],如果目标不存在,使用[]会造成未定义行为,使用at()会抛出一个异常供处理.

        j.at("name").get_to(p.name);
        j.at("address").get_to(p.address);
        j.at("age").get_to(p.age);
        
        or:

        s2 = j.at("name").get<std::string>();

        如果通过j["aaa"]["bbb"]去读的话,会自动修改该json文件中的aaa,bbb项{"aaa":{"bbb":null}}

3.写

    json["value"] = b1;