Is it possible to decode a nullopt as null for optional fields in a struct? #497
-
Example struct A {
optional<int> a;
}
JSONCONS_N_MEMBER_TRAITS(A, 0, a)
int main() {
std::string result;
jsoncons::encode_json(A{}, result); // result -> "{}"
} If result were |
Beta Was this translation helpful? Give feedback.
Answered by
danielaparker
Mar 26, 2024
Replies: 1 comment
-
Either
or
would produce
But non-mandatory means that the member can be omitted. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
recsater
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Either
or
would produce
But non-mandatory means that the member can be omitted.