Skip to content

Is it possible to decode a nullopt as null for optional fields in a struct? #497

Answered by danielaparker
recsater asked this question in Q&A
Discussion options

You must be logged in to vote

Either

JSONCONS_ALL_MEMBER_TRAITS(A, a) 

or

JSONCONS_N_MEMBER_TRAITS(A, 1, a)

would produce

{ "a": null }

But non-mandatory means that the member can be omitted.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by recsater
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants