From 9f788546c854bab4e364a359e2e2941ad9675e5f Mon Sep 17 00:00:00 2001 From: Kishore Nallan Date: Sat, 17 Aug 2019 19:40:58 +0530 Subject: [PATCH] Return json object rather than string for convenience. --- include/collection.h | 4 ++-- src/collection.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/collection.h b/include/collection.h index 853070ab..3960bd0e 100644 --- a/include/collection.h +++ b/include/collection.h @@ -66,7 +66,7 @@ struct override_t { } } - std::string to_json_str() const { + nlohmann::json to_json() const { nlohmann::json override; override["id"] = id; override["rule"]["query"] = rule.query; @@ -88,7 +88,7 @@ struct override_t { override["excludes"].push_back(exclude); } - return override.dump(); + return override; } }; diff --git a/src/collection.cpp b/src/collection.cpp index a0240816..131daa42 100644 --- a/src/collection.cpp +++ b/src/collection.cpp @@ -932,7 +932,7 @@ Option Collection::add_override(const override_t & override) { return Option(409, "There is already another entry with that `id`."); } - bool inserted = store->insert(Collection::get_override_key(name, override.id), override.to_json_str()); + bool inserted = store->insert(Collection::get_override_key(name, override.id), override.to_json().dump()); if(!inserted) { return Option(500, "Error while storing the override on disk."); }