I was wondering if there's a way to manipulate the JSON return from the method postForObject of the class RestTemplate. I read on an old question about the class JSONObject but I noticed that has been replaced by JsonObject and I don't if it works exactly in the same way. Here's my method:
public void sendEmail() throws FirebaseAuthException {
    Body body = new Body(firebase.createCustomToken("username"), true);
    RestTemplate t = new RestTemplate();
    Object response = t.postForObject(
            "https://identitytoolkit.googleapis.com/v1/accounts:signInWithCustomToken?key=[API_KEY]", 
            body, Object.class);
}
The firebase.createCustomToken("username") method is a method that I use to return a custom token for a user. The firebase object is an object of the class FireBaseService in which I wrote all the useful methods to work with FireBase.
I passed as body of the POST method a String and a boolean. Everything works good but I don't know how to get the value of a certain JSON field. The value of response is:
{
  "idToken": "[ID_TOKEN]",
  "refreshToken": "[REFRESH_TOKEN]",
  "expiresIn": "3600"
}
The REST API call I'm doing is this: https://firebase.google.com/docs/reference/rest/auth#section-verify-custom-token.
How can I get the value of the field idToken?
 
    