Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public JSONOutput(Map<String, Object> outputMap) {
- super(outputMap);
- if (outputMap.isEmpty()) {
- responseJson.put("response", new JSONArray());
- }
- else if(outputMap.size() == 1) {
- //obj - first element of LinkedHashMap
- if (obj instanceof ResultImpl) {
- responseJson.put("response", getJson((ResultImpl) obj));
- } else {
- responseJson.put("response", obj);
- }
- }
- else {
- for (Map.Entry<String, Object> entry : outputMap.entrySet()) {
- Object obj = entry.getValue();
- if (obj instanceof ResultImpl) {
- responseJson.append("response", getJson((ResultImpl) obj));
- } else {
- responseJson.append("response", obj);
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment