Return json object rather than string for convenience.

This commit is contained in:
Kishore Nallan 2019-08-17 19:40:58 +05:30
parent 2952b0d461
commit 9f788546c8
2 changed files with 3 additions and 3 deletions

View File

@ -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;
}
};

View File

@ -932,7 +932,7 @@ Option<uint32_t> Collection::add_override(const override_t & override) {
return Option<uint32_t>(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<uint32_t>(500, "Error while storing the override on disk.");
}