title: Django REST framework: create JSON fragments from string
body: <p>I want to store JSON fragments in TextField of my model with JSON:</p>
  
  <pre><code>class A(models.Model):
      name = models.CharField(max_length=200)
      people = models.TextField()
  </code></pre>
  
  <p>I have serializer class:</p>
  
  <pre><code>class ASerializer(serializers.HyperlinkedModelSerializer):
      class Meta:
          model = A
          fields = ('name', 'people')
  </code></pre>
  
  <p>How can I told Django REST Framework to treat people string like JSON, not like string. E.g. when people is [ {"name":"A", "surname":"B"}] I want have in JSON generated by Django REST framework </p>
  
  <pre><code>"people" : [ {"name":"A", "surname":"B"}]
  </code></pre>
  
  <p>and not</p>
  
  <pre><code>"people" : "[ {\"name\":\"A\", \"surname\":\"B\"}]"
  </code></pre>
  
  <hr>
  
  <p>Edit: I change ASerializer class and used JSONField from django-jsonfield and everything works. New code below, transform_people method serves to serialization and validate_people to deserialization:</p>
  
  <pre><code>class ASerializer(serializers.ModelSerializer):
      def transform_people(self, obj, value):
          if obj is None:
              return obj
          else:
              return obj.people
  
      def validate_people(self, attrs, source):
          return attrs
  
      class Meta:
          model = A
  </code></pre>