title: How to send create a JSON string and send it from server to android?
body: <p>In my application a user will preform a <code>HTTPrequest</code> to retrieve data from the server.</p>
  
  <p>At the moment on the server side, i preform a database select statement and then use the <code>ResultSetDynaBean</code> to retrieve each row and convert to an object and store in an <code>ArrayList</code>. this all works fine. </p>
  
  <pre><code> ArrayList&lt;ParkingSpot&gt; spotsList
  </code></pre>
  
  <p>I then convert eachobject to a JSON string using google GSON library</p>
  
  <pre><code>ArrayList&lt;String&gt; jsonStrings = new ArrayList&lt;String&gt;();
      Gson gson = new Gson();
      for (ParkingSpot ps : spotsList) {
          String json = gson.toJson(ps);
          jsonStrings.add(json);
      }
  </code></pre>
  
  <p>Each json string looks like this</p>
  
  <pre><code>{"address":"York Road","zone":"Green","startTime":7.0,"endTime":24.0,"timeAdded":"Jun 16, 2011 11:53:27 AM","psId":898}
  </code></pre>
  
  <p>there can be up to 1000 of the above strings that i need to send</p>
  
  <p>As you can see i add each to a String <code>ArrayList</code>. i do not think this is correct. </p>
  
  <p>How should i go about sending the information to an android phone.</p>
  
  <p>From the GSON library i can call the below on the android phone</p>
  
  <pre><code> Spot spot = gson.fromJson(jsonString, Spot.class);
            System.out.println(spot);
  </code></pre>
  
  <p>But i do not know how retrieve the jsonString from the response of my <code>Servlet</code>(i also do not know how to set it on the servlet side either)</p>