Leosac  0.8.0
Open Source Access Control
JSONUtils.hpp File Reference
#include "core/auth/AuthFwd.hpp"
#include "exception/leosacexception.hpp"
#include "tools/Uuid.hpp"
#include <boost/lexical_cast.hpp>
#include <chrono>
#include <nlohmann/json.hpp>
#include <type_traits>
+ Include dependency graph for JSONUtils.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  nlohmann::adl_serializer< Leosac::UUID >
 

Namespaces

 nlohmann
 Below we add a serializer into the nlohmann namespace to serialize the Leosac::UUID ype.
 
 Leosac
 This is the header file for a generated source file, GitSHA1.cpp.
 
 Leosac::JSONUtil
 Add a few useful extraction functions.
 

Functions

template<typename T >
std::enable_if<!std::is_same< const char *, T >::value &&!std::is_same< std::chrono::system_clock::time_point, std::remove_reference_t< T > >::value &&!std::is_enum< T >::value, T >::type Leosac::JSONUtil::extract_with_default (const nlohmann::json &obj, const std::string &key, T default_value)
 Extract the value of a key from a json object. More...
 
template<typename T >
std::enable_if< std::is_enum< T >::value, T >::type Leosac::JSONUtil::extract_with_default (const nlohmann::json &obj, const std::string &key, T default_value)
 
template<typename T >
std::enable_if< std::is_same< const char *, T >::value, std::string >::type Leosac::JSONUtil::extract_with_default (const nlohmann::json &obj, const std::string &key, T default_value)
 
std::chrono::system_clock::time_point Leosac::JSONUtil::extract_with_default (const nlohmann::json &obj, const std::string &key, const std::chrono::system_clock::time_point &tp)
 Extract an ISO 8601 datetime string from a json object. More...
 
Auth::ValidityInfo Leosac::JSONUtil::extract_validity_with_default (const nlohmann::json &obj, const std::string &base_key, const Auth::ValidityInfo &def)
 Extract fields representing a ValidityInfo object. More...