title: convert list of class objects into json in python or django
body: <pre><code>my_objects = []
  my_objects.append(Needed("bye",9))
  my_objects.append(Needed("tata",8))
  my_objects.append(Needed("hi",10))
  </code></pre>
  
  <p>i have list of object(example 5 objects in list) like this</p>
  
  <pre><code>class Needed:
  
     def __init__(self, name, number):
        self.name = name
        self.number = number
  </code></pre>
  
  <p>and i need to convert this into json order by count like below</p>
  
  <pre><code>{
     "results":[
                 { "name":"hi",
                   "number":"10"
                  },
                  { "name":"bye",
                   "number":"9"
                  },
                  { "name":"tata",
                   "number":"8"
                  },
                  ...........
                  ...........
                ]
  }
  </code></pre>
  
  <p>so how to achieve this in django</p>