Hi

One of the simplest ways is to use special serializer. At least django-nap
and django-rest-framework do have excellent serializers you can leverage.

Django itself also has serializer you can use.
https://docs.djangoproject.com/en/1.11/topics/serialization/

16.9.2017 13.26 "yingi keme" <[email protected]> kirjoitti:

> Say you have a simple class
>
> class Cart(object):
>     def _init_(self, name, age):
>         self.name = name
>         self.age = age
>
> And then you have an instance of the class
>
> T = Cart('john', 23)
>
> How will you serialize the object instance T using json?
>
> I know json serializes limited data structure. But i think there is a
> custom way to serialize and deserialize Object instances.
>
> Please help.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/67356dad-a1cd-40f0-aaf5-8a32ed481676%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ofw_JPyEuZJ2fG48w6kydPFzbdq5SjYHRWK0TDaSNehZg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to