0

Here is my code:

   public Map<Object, Object> getJiras(String values) throws Exception {       

    {
      ...
       Map<Object, Object> map=new HashMap<Object,Object>();
        for(int i=0;i<jsonarr_1.size();i++){
            JSONObject jsonobj_1 = (JSONObject)jsonarr_1.get(i);
            JSONObject jsonobj_2 = (JSONObject)jsonobj_1.get("fields");
            JSONObject status1   = (JSONObject)jsonobj_2.get("status");
            JSONObject issuetype = (JSONObject)jsonobj_2.get("issuetype");
            String var      =  issuetype.get("name").toString();
            System.out.println("\nProject Type: "+var);
            JSONObject email     = (JSONObject)jsonobj_2.get("assignee");
             Object obj3         =  email.get("emailAddress");
            System.out.println(obj3);
            if((var.equals(s2)) || (var.equals(s3)))
            {

            Object obj1         =  jsonobj_1.get("key");
            Object obj2         =  status1.get("name");
            Object obj3         =  email.get("emailAddress");

            map.put(obj1, obj2);
            }
        }
        return  map;
     }

Actually I need to return the obj3 to my servlet which calls this getJiras().How can I return it.Please help me with the solution.Thanks in advance.

RAMYA
  • 89
  • 1
  • 8

1 Answers1

1

Simply add your obj3 to the Map.

map.put("obj3", obj3);

now when returned obtain it using,

Map<Object, Object> map = getJiras("xxxx");
Object obj3 = map.get("obj3");

you may also remove it from the Map if necessary, after retrieving it,

map.remove("obj3");
Roshana Pitigala
  • 8,437
  • 8
  • 49
  • 80