35 using value_type = boost::json::value;
36 using object_type = boost::json::object;
37 using array_type = boost::json::array;
38 using string_type = std::string;
39 using number_type = double;
40 using integer_type = std::int64_t;
41 using boolean_type = bool;
43 static jwt::json::type get_type(
const value_type& val) {
44 using jwt::json::type;
45 if (val.is_bool())
return type::boolean;
46 if (val.is_int64() || val.is_uint64())
return type::integer;
47 if (val.is_double())
return type::number;
48 if (val.is_string())
return type::string;
49 if (val.is_array())
return type::array;
53 static bool parse(value_type& val,
const string_type& str) {
55 val = boost::json::parse(str);
62 static std::string serialize(
const value_type& val) {
63 return boost::json::serialize(val);
66 static object_type as_object(
const value_type& val) {
67 return val.as_object();
70 static array_type as_array(
const value_type& val) {
71 return val.as_array();
74 static string_type as_string(
const value_type& val) {
75 return std::string(val.as_string());
78 static number_type as_number(
const value_type& val) {
79 if (val.is_double()) {
80 return val.as_double();
81 }
else if (val.is_int64()) {
82 return static_cast<double>(val.as_int64());
84 return static_cast<double>(val.as_uint64());
88 static integer_type as_integer(
const value_type& val) {
90 return val.as_int64();
92 return static_cast<integer_type
>(val.as_uint64());
96 static boolean_type as_boolean(
const value_type& val) {