I have the following JSON:
{"errors":[{"code":888,"errorId":"xxx","message":"String value expected","fields":["name", "address"]}, {}, {}]}
I want to be able to get the "fields" as follows:
public static String getField(json, errorsIndex, fieldIndex) { JSONObject errorJson = json.getJSONArray("errors").getJSONObject(errorIndex); String value = errorJson.[getTheListOfMyFields].get(fieldIndex); return value; }
But I can’t find a way to make this part [getTheListOfMyFields]. Any suggestion?
lenka source share