You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to (de-)serialize it into a custom struct. The report url is optional and only considered if the report field is set to true. Now, I could write a struct that directly maps the above structure, i.e.
I have the following JSON given to me:
I want to (de-)serialize it into a custom struct. The report url is optional and only considered if the
report
field is set totrue
. Now, I could write a struct that directly maps the above structure, i.e.However, this essentially duplicates the information that the
report_url
is not present and I'd rather write:where the
report_url
field is set toSome(value)
iff thereport
flag in the JSON is set to true, and toNone
otherwise. Is this possible with serde?The text was updated successfully, but these errors were encountered: