title: Why is parsing a single item String into a JSONArray failing
body: <p>I was wondering why my parsing code is not working. I am trying to get responses from a webserver (<code>GET</code>) request into a <code>JASONArray</code>. This is already working for multiple items (using <code>GET http://10.0.2.2:8000/exercises</code>). But if I try to receive a single item (<code>GET http://10.0.2.2:8000/exercises/1</code>) it fails. I already found the cause of the problem. <code>respJSON = new JSONArray(resp);</code> seems to fail on a String that is not surounded by <code>[</code> and <code>]</code>, as you can see from my sample output. 
  Can anybody tell me what I am doing wrong here? Should I use a different method, specifically designed for simgle item requests to handle this? I could use a simple check for the first character in the string, but that is such a hack, that I cant believe this is the best way todo it. </p>
  
  <p>(I am only posting the very minimal code of what I use + the output) </p>
  
  <pre><code>HttpHost target = new HttpHost(host, port, "http");
  HttpGet getRequest = new HttpGet(requestPath);
  getRequest.setHeader("Content-type", "application/json");
  getRequest.setHeader("Accept", "application/json");
  response = httpClient.execute(target, getRequest);
  
  entity = response.getEntity();
  String resp = EntityUtils.toString(entity);
  return new JSONArray(resp);
  </code></pre>
  
  <p>Using this code on a request like <code>http://10.0.2.2:8000/exercises</code> produces the following output String, which can be parsed into a <code>JSONArray</code> (leaving the actual data in here, for better comparsion): </p>
  
  <pre><code>[{"name": "Ringe", "duration": "20", "repeats": "no repeats", "creationtime": "2014-06-07 19:24:53.206000", "pausetime": "3", "alarmsound": "default", "description": "this is android description", "type": "repeats"}, {"name": "fingerkraft", "duration": "-1", "repeats": "10", "creationtime": "2014-06-07 18:08:03.576000", "pausetime": "20", "alarmsound": "default", "description": "asdasdasd", "type": "repeats"}, {"name": "ringe", "duration": "12", "repeats": "no", "creationtime": "2014-06-07 00:54:22.844000", "pausetime": "23", "alarmsound": "default", "description": "asdasdasd", "type": "duration"}]
  </code></pre>
  
  <p>However, using this method on <code>http://10.0.2.2:8000/exercises/1</code> produces a String like </p>
  
  <pre><code>{"name": "ringe", "duration": "12", "repeats": "no", "creationtime": "2014-06-07 00:54:22.844000", "pausetime": "23", "alarmsound": "default", "description": "asdasdasd", "type": "duration"}
  </code></pre>
  
  <p>which can't be parsed into a <code>JSONArray</code> (return is null). So, is this the expected behaviour? I built the API (which is obviously rest) with the django-rest-framework. </p>