00001 #include <json.hpp> 00002 00003 using json = nlohmann::json; 00004 00005 int main() 00006 { 00007 // create JSON values 00008 json j_object = {{"one", 1}, {"two", 2}}; 00009 json j_array = {1, 2, 4, 8, 16}; 00010 00011 // call dump() 00012 std::cout << j_object.dump() << "\n\n"; 00013 std::cout << j_object.dump(-1) << "\n\n"; 00014 std::cout << j_object.dump(0) << "\n\n"; 00015 std::cout << j_object.dump(4) << "\n\n"; 00016 std::cout << j_array.dump() << "\n\n"; 00017 std::cout << j_array.dump(-1) << "\n\n"; 00018 std::cout << j_array.dump(0) << "\n\n"; 00019 std::cout << j_array.dump(4) << "\n\n"; 00020 }