Move json stuff out of util.cc

This commit is contained in:
Eelco Dolstra
2022-05-04 11:22:06 +02:00
parent 1385b20078
commit 3e87c8e62b
4 changed files with 22 additions and 20 deletions
+21
View File
@@ -0,0 +1,21 @@
#pragma once
#include <nlohmann/json.hpp>
namespace nix {
const nlohmann::json * get(const nlohmann::json & map, const std::string & key)
{
auto i = map.find(key);
if (i == map.end()) return nullptr;
return &*i;
}
nlohmann::json * get(nlohmann::json & map, const std::string & key)
{
auto i = map.find(key);
if (i == map.end()) return nullptr;
return &*i;
}
}