nix-super/src/libutil/json-utils.hh

23 lines
398 B
C++
Raw Normal View History

2022-05-04 12:22:06 +03:00
#pragma once
///@file
2022-05-04 12:22:06 +03:00
#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;
}
}