title: How to get JSON Array Java
body: <p>I have code to get JSON Object but now I need to get a JSON Array.</p>
  
  <pre><code>JSONObject jData = new JSONObject(data);
          JSONObject rates = jData.getJSONObject("page");
          JSONArray namesArray = rates.names();
          for (int i = 0; i &lt; namesArray.length(); i++) {
              String currency = namesArray.getString(i);
              String rate = rates.getString(currency);
              stringBuilder.append(String.format("%s: %s\n", currency, rate));
          }
  </code></pre>