type.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 type()
00017     std::cout << std::boolalpha;
00018     std::cout << (j_null.type() == json::value_t::null) << '\n';
00019     std::cout << (j_boolean.type() == json::value_t::boolean) << '\n';
00020     std::cout << (j_number_integer.type() == json::value_t::number_integer) << '\n';
00021     std::cout << (j_number_float.type() == json::value_t::number_float) << '\n';
00022     std::cout << (j_object.type() == json::value_t::object) << '\n';
00023     std::cout << (j_array.type() == json::value_t::array) << '\n';
00024     std::cout << (j_string.type() == json::value_t::string) << '\n';
00025 }


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