python - Serialize an object in django not a model -


I want to serial an object but this object is not a model, it's just a regular class. How can I do this

  class test: foo = [] times = 1a = tt () square tt a = "test"  

Do you really want this to be an object? It seems that it would be better as a nested trunk:

  {'foo': [], 'bar': 1, 'a': {'a': 'test' }}  

This is definitely json.dumps () .

can be directly serialized on JSON.

Comments