jsonarray find

Solutions on MaxInterview for jsonarray find by the best coders in the world

showing results for - "jsonarray find"
Kody
12 Jan 2020
1JSONArray event_values = opoutput.getJSONArray("DISPLAY_VALUES");
2JSONArray event_codes = opoutput.getJSONArray("VALUES");
3
4List<String> valueList = new ArrayList<String>();
5List<String> displayList = new ArrayList<String>();
6for(int i=0;i<event_codes.length();i++){
7        // if both event_values and event_codes are of equal length
8        valueList.add(event_codes.getString(i));
9        displayList.add(event_values.getString(i));
10    }
11
12int index = valueList.indexOf("ACCPT");
13String valueToDisplay = displayList.get(index);