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'm trying to use nlohmann/json to deserialize two classes that are inherited: Person and Child, where the Person class is the parent of the Child class. When I deserialize Child in the main function, I find that I can only get the fields of child itself, but not the fields of person.
Here is my code demo.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm trying to use nlohmann/json to deserialize two classes that are inherited: Person and Child, where the Person class is the parent of the Child class. When I deserialize Child in the main function, I find that I can only get the fields of child itself, but not the fields of person.
Here is my code demo.
I have no idea how to make it work. Thank you for your help!
Beta Was this translation helpful? Give feedback.
All reactions