title: Django Rest Framework nested serializer
body: <p>I have models like -</p>
  
  <pre><code>class Sectors(models.Model):
    sector_mc = models.TextField()
  
  class Insector(models.Model):
    foundation = models.ForeignKey(Sectors)
    name = models.TextField()
    value = models.FloatField(default=0)
  </code></pre>
  
  <p>I want my data to be in a format like-</p>
  
  <pre><code>                        "name": "cluster",
                          "children": [
                              {"name": "Tester", "value": 3938},
                              {"name": "CommunityStructure", "value": 3812},
                          ]
                      },
                      {
                          "name": "graph",
                          "children": [
                              {"name": "BetweennessCentrality", "value": 34},
                              {"name": "LinkDistance", "value": 5731},
                          ]
                      }
  </code></pre>
  
  <p>So "cluster" goes in "sector_mc" of "Sectors"
   and cluster has children "Tester" and "CommunityStructure"(these go in "name" and "value" of "Insector" for cluster sector_mc)</p>
  
  <p>Similarly "graph" goes in "sector_mc" of Sectors and graph has children  "BetweennessCentrality" and "LinkDistance"(these go in "name" and "value" of "Insector" for graph sector_mc)</p>
  
  <p>And so on.</p>
  
  <p>How to save these with the same relation in the database and also, how to use DRF to structure it in this format. I tried using nested relationship of DRF with this but reached no where.</p>
  
  <p>I need the data to be in this format for d3 sunburst chart. If there are any other workarounds, I'd be very open to know them as well. Thank you</p>