title: Android - how to parse JsonArray from string?
body: <p>I am trying to parse a json array from json string but it always throws the exception <code>data of type java.lang.String cannot be converted to JSONArray</code>.</p>
  
  <p>Please tell me if I make any mistake.</p>
  
  <p>Thanks.</p>
  
  <p>Here is my codes to get Json from server:</p>
  
  <pre><code>try {
                  String url = String.format(&lt;url here&gt;, province.provinceCode2);
                  HttpClient httpClient = getHttpClient();
                  HttpGet httpGet = new HttpGet(url);
                  HttpResponse httpResponse = httpClient.execute(httpGet);
                  HttpEntity entity = httpResponse.getEntity();
                  final String result = EntityUtils.toString(entity);
                  parseAndSaveJsonData(province, result);
              } catch (Exception e) {
                  e.printStackTrace();
              }
  </code></pre>
  
  <p>here is codes to parse JsonArray:</p>
  
  <pre><code>String jsonString = &lt;below json string&gt;
  JSONArray ja = new JSONArray(jsonString);
  </code></pre>
  
  <p>Here is my json string:</p>
  
  <pre><code>   [
     {
        "LotPrizes":[
           {
              "Prize":"Giảitám",
              "Range":"50"
           },
           {
              "Prize":"Giảibảy",
              "Range":"264"
           },
           {
              "Prize":"Giảisáu",
              "Range":"3654-5162-3097"
           },
           {
              "Prize":"Giảinăm",
              "Range":"9739"
           },
           {
              "Prize":"Giảitư",
              "Range":"97690-99274-32442-69432-04855-10132-17085"
           },
           {
              "Prize":"Giảiba",
              "Range":"73745-13007"
           },
           {
              "Prize":"Giảinhì",
              "Range":"05521"
           },
           {
              "Prize":"Giảinhất",
              "Range":"74870"
           },
           {
              "Prize":"GiảiDB6",
              "Range":"878833"
           }
        ]
        },
   {
        "LotPrizes":[
           {
              "Prize":"Giảitám",
              "Range":"50"
           },
           {
              "Prize":"Giảibảy",
              "Range":"264"
           },
           {
              "Prize":"Giảisáu",
              "Range":"3654-5162-3097"
           },
           {
              "Prize":"Giảinăm",
              "Range":"9739"
           },
           {
              "Prize":"Giảitư",
              "Range":"97690-99274-32442-69432-04855-10132-17085"
           },
           {
              "Prize":"Giảiba",
              "Range":"73745-13007"
           },
           {
              "Prize":"Giảinhì",
              "Range":"05521"
           },
           {
              "Prize":"Giảinhất",
              "Range":"74870"
           },
           {
              "Prize":"GiảiDB6",
              "Range":"878833"
           }
        ]
        }
  
      ]
  </code></pre>