Go to the documentation of this file. 1 #ifndef JWT_CPP_NLOHMANN_JSON_TRAITS_H
2 #define JWT_CPP_NLOHMANN_JSON_TRAITS_H
42 throw std::logic_error(
"invalid type");
48 throw std::bad_cast();
55 throw std::bad_cast();
56 return val.get<std::string>();
62 throw std::bad_cast();
72 default:
throw std::bad_cast();
79 throw std::bad_cast();
80 return val.get<
bool>();
86 throw std::bad_cast();
87 return val.get<
double>();
92 val = json::parse(
str.begin(),
str.end());
static json::object_t as_object(const json &val)
ObjectType< StringType, basic_json, default_object_comparator_t, AllocatorType< std::pair< const StringType, basic_json > >> object_t
a type for an object
static bool as_bool(const json &val)
json::object_t object_type
static int64_t as_int(const json &val)
static double as_number(const json &val)
@ number_unsigned
number value (unsigned integer)
@ number_float
number value (floating-point)
std::string str(TimeType value=SystemClock::now< TimeType >())
Returns the provided time (or current time if omitted) as a human-readable string.
static std::string as_string(const json &val)
BooleanType boolean_t
a type for a boolean
static jwt::json::type get_type(const json &val)
static bool parse(json &val, std::string str)
NumberIntegerType number_integer_t
a type for a number (integer)
@ number_integer
number value (signed integer)
type
Generic JSON types used in JWTs.
@ array
array (ordered collection of values)
@ object
object (unordered set of name/value pairs)
json::number_integer_t integer_type
NumberFloatType number_float_t
a type for a number (floating-point)
basic_json<> json
default specialization
json::number_float_t number_type
static std::string serialize(const json &val)
static json::array_t as_array(const json &val)
json::boolean_t boolean_type
ArrayType< basic_json, AllocatorType< basic_json > > array_t
a type for an array