I'm relatively new to Django, and I'm using version 1.5 to build a REST api. Calls to the api expect JSON to be returned (I'm using this with an Ember.js front-end).

I'm wondering if I can't do something like this:

```
def listproject(request, pk_id):
  # list single project at /projects/<pk_id>
  project = Project.objects.get(pk = pk_id)
  snapshots = Snapshot.objects.filter(project = project)

  # (both are same up to here)

  return render_to_response('project.json',
    {"project":project, "snapshots":snapshots},
    mimetype="text/json")

```

Where `project.json` is this Django template:

```
{
  "id": "{{ project.pk }}",
  "name": "{{ project.name }}",
  "snapshot_ids": [ {% for snapshot in snapshots %}"{{ snapshot.pk }}"{% if not forloop.last %}, {% endif %}{% endfor %}
}

```

Someone who has worked with Django much longer than I have is suggesting that using templates for this will be inefficient. He suggests I do the following instead:

```
def listproject(request, pk_id):
  # list single project at /projects/<pk_id>
  project = Project.objects.get(pk = pk_id)
  snapshots = Snapshot.objects.filter(project = project)

  # (both are same up to here)

  ret_json = []
  ret_json.append('{"id": "' + str(project.pk) + '", ')
  ret_json.append('"name": "' + project.name + '", "snapshot_ids": [')

  snapshot_json = []
  for snapshot in snapshots:
    snapshot_json.append('"' + str(snapshot.pk) + '",')
  ret_json.append(''.join(snapshot_json)[0:-1] + ']}')

  return HttpResponse(content=''.join(ret_json), mimetype="text/json")

```

I've tested both. They work identically, though my version produces more readable JSON.

Please help us end our debate! Which is more efficient (and why)?