count.cpp
Go to the documentation of this file.
00001 #include <json.hpp>
00002 
00003 using json = nlohmann::json;
00004 
00005 int main()
00006 {
00007     // create a JSON object
00008     json j_object = {{"one", 1}, {"two", 2}};
00009 
00010     // call find
00011     auto count_two = j_object.count("two");
00012     auto count_three = j_object.count("three");
00013 
00014     // print values
00015     std::cout << std::boolalpha;
00016     std::cout << "number of elements with key \"two\": " << count_two << '\n';
00017     std::cout << "number of elements with key \"three\": " << count_three << '\n';
00018 }


rc_visard_driver
Author(s): Heiko Hirschmueller , Christian Emmerich , Felix Ruess
autogenerated on Thu Jun 6 2019 20:43:02