code: public static JSONArray rowToJSONArray(JSONTokener x) throws JSONException {
      JSONArray ja = new JSONArray();
      for (;;) {
        String value = getValue(x);
        char c = x.next();
        if (value == null || (ja.length() == 0 && value.length() == 0 && c != ',')) {
          return null;
        }
        ja.put(value);
        for (;;) {
          if (c == ',') {
            break;
          }
          if (c != ' ') {
            if (c == '\n' || c == '\r' || c == 0) {
              return ja;
            }
            throw x.syntaxError("Bad character '" + c + "' (" + (int) c + ").");
          }
          c = x.next();
        }
      }
    }
docs: Produce a JSONArray of strings from a row of comma delimited values.
  
  @param x
  A JSONTokener of the source text.
  @return A JSONArray of strings.
  @throws JSONException