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 // serialize without indentation 00012 std::cout << j_object << "\n\n"; 00013 std::cout << j_array << "\n\n"; 00014 00015 // serialize with indentation 00016 std::cout << std::setw(4) << j_object << "\n\n"; 00017 std::cout << std::setw(2) << j_array << "\n\n"; 00018 }