Exemplo n.º 1
0
 /**
  * Produce a comma delimited text from a JSONArray of JSONObjects using a provided list of names.
  * The list of names is not included in the output.
  *
  * @param names A JSONArray of strings.
  * @param ja A JSONArray of JSONObjects.
  * @return A comma delimited text.
  * @throws JSONException
  */
 public static String toString(JSONArray names, JSONArray ja) throws JSONException {
   if (names == null || names.length() == 0) {
     return null;
   }
   StringBuffer sb = new StringBuffer();
   for (int i = 0; i < ja.length(); i += 1) {
     JSONObject jo = ja.optJSONObject(i);
     if (jo != null) {
       sb.append(rowToString(jo.toJSONArray(names)));
     }
   }
   return sb.toString();
 }