operator__value_t.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 JSON values
00008     json j_null;
00009     json j_boolean = true;
00010     json j_number_integer = 17;
00011     json j_number_float = 23.42;
00012     json j_object = {{"one", 1}, {"two", 2}};
00013     json j_array = {1, 2, 4, 8, 16};
00014     json j_string = "Hello, world";
00015 
00016     // call operator value_t()
00017     json::value_t t_null = j_null;
00018     json::value_t t_boolean = j_boolean;
00019     json::value_t t_number_integer = j_number_integer;
00020     json::value_t t_number_float = j_number_float;
00021     json::value_t t_object = j_object;
00022     json::value_t t_array = j_array;
00023     json::value_t t_string = j_string;
00024 
00025     // print types
00026     std::cout << std::boolalpha;
00027     std::cout << (t_null == json::value_t::null) << '\n';
00028     std::cout << (t_boolean == json::value_t::boolean) << '\n';
00029     std::cout << (t_number_integer == json::value_t::number_integer) << '\n';
00030     std::cout << (t_number_float == json::value_t::number_float) << '\n';
00031     std::cout << (t_object == json::value_t::object) << '\n';
00032     std::cout << (t_array == json::value_t::array) << '\n';
00033     std::cout << (t_string == json::value_t::string) << '\n';
00034 }


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