7 #include <nlohmann_json/json.hpp> 8 #include "json_object.h" 28 throw std::runtime_error(
29 "\nWARNING: In utilities::JsonObject::delete_key: Key not present, so " 30 "no values were erased\n");
37 const std::string& output_location)
const {
39 std::ofstream output_file;
40 output_file.open(output_location);
42 if (!output_file.is_open()) {
44 throw std::runtime_error(
45 "\nERROR: In utilities::JsonObject::write_to_file(): Could not open " 50 output_file << std::setw(4) <<
json_object_ << std::endl;
54 if (output_file.fail()) {
56 throw std::runtime_error(
57 "\nERROR: In utilities::JsonObject::write_to_file(): Error when " 58 "closing output location\n");
bool write_to_file(const std::string &output_location) const
bool delete_key(const std::string &key)
unsigned int get_size() const