I'd like to be able to customize what happens when deserializing a value that is defined in the JSON, but that has the wrong type. As an example, the following JSON:
{"x":"abc"}
and deserializing like this:
struct X {
int x;
template <typename io_type>
void json_io(io_type& io)
{
json_dto::optional("x", x, 0);
}
};
This leads to an exception because we are expecting a number, but are getting a string instead. It'd be nice if we could set a policy that we use the default value in that case.