I have a response from API that generates authorization token with some other attributes, I'm trying to extract the value of the token from the response which looks like below
{"access_token":"tokenvalue","scope":"somevalue","token_type":"Bearer","expires_in":value}
i tried JSON parse like below:
Myclass response = template.postForObject(url, requestEntity, Myclas.class);
JSONParser jsonParser = new JSONParser();
JSONObject obj = (JSONObject) jsonParser.parse(response);
String product = (String) jsonObject.get("access_token");
token = response;
}
Recieved error:
parse( )
in JSONParser cannot be applied
to
(java.lang.String)