Friday, January 8, 2021

How to fetch Session Id of JSONObject?

public static String extractSessionIDFromGetSessionId(String jsonObject) throws ParseException {

String methodName = "extractSessionIDFromGetSessionId";

LOGGER.debug(CLASS_NAME + "/" + methodName + "; jsonObject = " + jsonObject);

System.out.println(CLASS_NAME + "/" + methodName + "; jsonObject = " + jsonObject);


JSONParser parser = new JSONParser();

String sessionId = "";

System.out.println("JSON object is :" + jsonObject);

LOGGER.debug("JSON object is :" + jsonObject);


Object obj = parser.parse(jsonObject);

JSONObject jo = (JSONObject) obj;

sessionId = jo.get("sessionId").toString();

System.out.println("SessionId is : " + sessionId);


System.out.println("Exiting from the method : " + methodName);

LOGGER.debug("Exiting from the method : " + methodName);

return sessionId;

}

NOTE: JSON Jar is required


No comments:

Post a Comment

Fetch Members from Workgroup

  import java.util.ArrayList;   import java.util.Iterator;   import java.util.List;   import sailpoint.api.ObjectUtil;   import sailpoint.ob...