Replies: 1 comment
-
|
我也想要这个写法 因为之前在boost::optional是可以做这个操作的,但是在std::optional就没有作用了 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I would like to serialize a field that is std::optional in a way that if its value is std::nullopt then the json for this field will not appear at all.
Here is the example:
This will produce text:
serialization: {"address":"744 Evergreen Terrace","age":null,"nameOfPerson":"Ned Flanders"}but I would like to have:
serialization: {"address":"744 Evergreen Terrace","nameOfPerson":"Ned Flanders"}Is this possible to do in automatic way or do I have to write something like:
Thank you for any help.
Beta Was this translation helpful? Give feedback.
All reactions