title: Django rest framework non-model serializer
body: <p>Let's say I have a model like</p>
  
  <pre><code>class MyModel(models.Model):
      kwargs = models.TextField()
  </code></pre>
  
  <p>where the <code>kwargs</code> field is usually a JSON string, representing a dictionary of keyword arguments, e.g. <code>'{"X": 1, "Y": 2}'</code>.  It's not practical to modify this model, as it's a model belonging to a 3rd party app, and modifying the field would probably require a fork and other changes in the code.</p>
  
  <p>Now, I'm using <code>django-rest-framework</code> to provide and endpoint for creating/updating/listing/deleting instances of <code>MyModel</code>, and I have a serializer something like:</p>
  
  <pre><code>class MyModelSerializer(serializers.ModelSerializer):
      class Meta:
          model = MyModel
          fields = ('kwargs',)
  </code></pre>
  
  <p>to facilitate this. This all works OK, but for various reasons the user <em>does not</em> want to have manually enter the JSON dump string of the kwargs, i.e. manually entering <code>'{"X": 1, "Y": 2}'</code> in the text box or passing that manually built string. They'd rather be able to individually pass <code>X</code> and <code>Y</code> to the API.</p>
  
  <p>How can I achieve this with a serializer? In other words how can I create a serializer with non-model fields offered to the user, but which get dumped/combined into a JSON string on update/create and mapped to the <code>kwargs</code> model instance field accordingly.</p>