How to serialize a complex structure in Django?

How to work with complex structures in Django REST API.
(Noob question perhaps, yet experience in Django is not enough)

Trying to Google some options serialization in Django, and all the examples are tied to individual models. This is understandable. But I need to send to the client a complex JSON which contains various data (simple and instances of models).
 someVar: 10,
 someAnotherVar: "hello world",
 currentUser: user,
 lastPostsInForum: posts 

where user is an instance of the model User a posts an array of the last 5 Post.
And accordingly in the reverse direction comes to have the json structure.
June 10th 19 at 16:32
2 answers
June 10th 19 at 16:34
Probably found "Dealing with nested objects"
During the have to deal with django-rest-framework
thought this was made easier by the django.core.serializers (
June 10th 19 at 16:36
Serializer to write the post, and add it to the one that you need.
avatar = serializers.SerializerMethodField('get_image_url')

Find more questions by tags Django