I want to retrieve cliendId and clientSecret into 2 different Strings.
I am trying to do
String responseEntity = secretRequestMap.get("responseEntity").toString();
to get the responseEntity into a string and then parse it again, using JSON parser, but it throws an exception in thread "main":
java.lang.ClassCastException: org.json.simple.JSONObject cannot be cast to java.lang.String.
When I inspect it doesn't show any error but when I run it throws exception. Please help.
String response = {"statusCode":"200","responseEntity":{"clientId":"abc","clientSecret":"xyz"},"errorList":[]};
Map<String, String> responseMap = (Map<String, String>) new JSONParser().parse(response);