To parse/serialize raw JSON data, such as data from other libraries, one can use the json_raw
mapping type. The type requirement for mapping to json_raw
is constructable with a char const *
and a std::size_t
, along with supporting std::begin
/std::end
.
++
struct Foo {
std::string bar;
std::string raw_json;
};
template<>
struct json_data_contract<Foo> {
using type = json_member_list<
json_raw<"raw_json", std::string>
>;
static auto to_json_data( Foo const & v ) {
return std::forward_as_tuple( v.bar, v.raw_json );
}
};
}
typename json_details::ensure_mapped_t< json_details::json_deduced_type< T > >::template with_name< Name > json_link
Deduce the json type mapping based on common types and types already mapped.
Customization point traits.