Json Converts to Map




 try {

//{"actions":[{"name":"agree"},{"name":"disagree"}]}

Map<String, String> productTypes = new HashMap<String, String>();

String jsonData =(String) execution.getVariable("comboList");

JSONObject json = new JSONObject(jsonData);

JSONArray jsonArray = json.getJSONArray("actions");

for (int i = 0; i < jsonArray.length(); i++) {  

JSONObject explrObject = jsonArray.getJSONObject(i);

String name=explrObject.get("name").toString();

productTypes.put(name, name);

}

} catch (Exception e) {

e.printStackTrace();

}

Post a Comment

Previous Post Next Post