Open Zer0-One opened 2 years ago
This sounds like a useful feature, although using a single character that's something else than ?
might be easier implementation-wise.
Would you be interested in implementing this?
I'm taking a look at it. Having a bit of trouble wrapping my head around the code, but I'll get back to you on that.
A feature that I would find useful at the moment is the ability to unpack a given default value when the specified key is missing. You could add a double
?
as a format specifier, and then expect two arguments instead of one, the second being the default to "unpack" instead of the missing value.Something like this:
int unpk = json_unpack_ex(my_object, &error, 0, "{s??i}", "foo", 42, &i);