RM-3276 (Edit and Application of Marks to a Single User)

This commit is contained in:
Tuna Aksoy
2016-04-27 13:37:18 +01:00
parent 3314b1737c
commit 54ad44883c

View File

@@ -327,6 +327,30 @@ public final class WebScriptUtils
return jsonObject;
}
/**
* Creates a json array from the given {@link String}
*
* @param json The json array as {@link String}
* @return The json array created from the given {@link String}
*/
public static JSONArray createJSONArray(String json)
{
mandatory("json", json);
JSONArray jsonArray;
try
{
jsonArray = new JSONArray(json);
}
catch (JSONException error)
{
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Cannot create a json array from the given string '" + json + "'.", error);
}
return jsonArray;
}
/**
* Gets the {@link JSONArray} value of a given key from a json object
*