title: How to get pretty output from rest_framework serializer
body: <p>I'm using the django rest_gramework serializer, to dump json of my objects:</p>
  
  <pre><code>response = InstallSerializer(Install.objects.all(), many=True).data
  return StreamingHttpResponse(response, content_type='application/json')
  </code></pre>
  
  <p>where</p>
  
  <pre><code>class InstallSerializer(serializers.ModelSerializer):
      modules = ModuleSerializer(many=True)
  
      class Meta:
          model = Install
          fields = ('id', 'install_name', 'modules')
  </code></pre>
  
  <p>etc.</p>
  
  <p>However, this output is not "readable" ... it comes all on one line.</p>
  
  <pre><code>{'id': 1, 'install_name': u'Combat Mission Battle For Normandy', 'modules': [{'id': 1, 'name': u'Combat Mission Battle For Normandy', 'versions': [{'id': 1, 'name': u'1.00-Mac', 'brzs': [1, 2, 3]}]}]}
  </code></pre>
  
  <p>Is there a way to askk the serializer to format the output better?</p>
  
  <p>(For visual inspection for debug)</p>
  
  <p><strong>Note:</strong> I just learned that my approach for outputting the serialized form shown above does not even produce valid json, though it looks similar.   You have to do the json.dump step shown in the accepted answer below to get valid json, and as a bonus it is pretty as well.</p>