3 import org.json.simple.JSONArray;
9 * Converts a JSONArray of values to a string as a comma-separated list.
10 * Answers null if the array is null or empty.
15 public static String arrayToList(JSONArray jsonArray)
17 if (jsonArray == null)
22 StringBuilder sb = new StringBuilder();
23 for (int i = 0; i < jsonArray.size(); i++)
29 sb.append(jsonArray.get(i).toString());
31 return sb.length() == 0 ? null : sb.toString();