title: Removing fields from json
body: <p>I have a view function which renders json. I am able to specify which columns I want in my json but I don't know how to change the name of the key fields. Like the field "pk" should be "id". </p>
  
  <p>I am using this autocomplete control (<a href="http://loopj.com/2009/04/25/jquery-plugin-tokenizing-autocomplete-text-entry/" rel="nofollow noreferrer">http://loopj.com/2009/04/25/jquery-plugin-tokenizing-autocomplete-text-entry/</a>) and it requires the json to have certain fields.</p>
  
  <pre><code>from django.http import HttpResponse
  from django.shortcuts import render_to_response
  from iCookItThisWay.recipes import models
  from django.core import serializers
  from django.utils import simplejson
  
  def index(request, template_name):
      meal_types = []
      q = ''
  
      if 'q' in request.GET and request.GET['q']:
          q = request.GET['q']
  
      if len(q) &gt; 0:
          meal_types = models.MealType.objects.filter(name__istartswith=q)
  
      json_serializer = serializers.get_serializer("json")()
      sdata = json_serializer.serialize(meal_types, ensure_ascii=False, fields = ('id', 'name'))
  
      return HttpResponse(simplejson.dumps(sdata), mimetype='application/json')
  </code></pre>
  
  <p>Could you also please point me to some documentation. I feel that I am crap at finding documentation.</p>