public static ParameterSet fromJSONArray(JSONArray paramArray) throws JSONException, IOException { Object[] params = new Object[paramArray.length()]; for (int i = 0; i < paramArray.length(); i++) { params[i] = paramFromPossibleJSON(paramArray.get(i)); } return fromArrayNoCopy(params); }
static Object paramFromPossibleJSON(Object value) throws JSONException, IOException { if (value instanceof JSONObject) { JSONObject jsonObj = (JSONObject) value; return VoltTable.fromJSONObject(jsonObj); } if (value instanceof JSONArray) { JSONArray array = (JSONArray) value; Object[] retval = new Object[array.length()]; for (int i = 0; i < array.length(); i++) { Object valueAtIndex = array.get(i); retval[i] = paramFromPossibleJSON(valueAtIndex); } return retval; } return value; }