New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Serialization of nested serializable objects #57
Comments
Ah, I see. I need not to call person.toJson() directly but pass person to JSON.encode(). |
FWIW - I did the same thing and spent some time spinning on this. Might be good to show a little more usage in the readme to prevent others from the same issue. |
.... This is so stupid. |
Five years going and still a roadbump. Haven't found the trick yet though. @alexantenna where is It seems the generated |
Stuck for a time on this last year, and this year again :D |
|
Looks like serializing of annotated object with nested annotated objects via toJson() are not supported or I am completely don't understand how to do it.
Calling method toJson() even for your Person object (which is in your example along with nested Order and Item, code unchanged) fails to include serialized output of nested objects into final output.
Result:
{firstName: Alexey, lastName: Kartavenko, date-of-birth: 2017-10-07T15:15:11.616592, last-order: null, orders: [Instance of 'Order']}
Looking into generated model code I don't see any attempts to call toJson() method of Order object. Is this by design or am I missing something obvious here?
The text was updated successfully, but these errors were encountered: