title: How to write my data in json file?
body: <p>How to write my data in json file? This is my try:</p>
  
  <pre><code>from django.test import TestCase
  from django_dynamic_fixture import G
  import content.factories
  from django.core import serializers
  from content.models import UserProfile, Delivery
  from django.contrib.auth.models import User
  
  class DeliveryTest(TestCase):
      def test_sample_data(self):
          for i in range(0,10):
              user = content.factories.UserFactory.create()
              print user
              for j in range(0, 50):
                  delivery = content.factories.DeliveryFactory.create(user=user)
                  print delivery
  
                  with open("file.json", "w") as out:
                      data = serializers.serialize("json", User.objects.all() ) 
  
                  with open("file.json", "w") as out:
                      data2 = serializers.serialize("json", Delivery.objects.all() )
  </code></pre>
  
  <p>Output (print): <a href="http://dpaste.com/hold/923339/" rel="nofollow">http://dpaste.com/hold/923339/</a></p>