Sometimes can be useful extract some specific attribute from a JSON string. This can be done easily with com.google.code.gson library in this way.
Let’s consider the following JSON:

{
    "field1": "Field1 value",
    "field2": {"Field2 value",
}

This is the maven dependancy:

<dependency>
    <groupId>com.google.code.gson</groupId>
    <artifactId>gson</artifactId>
</dependency>

And finally the code to extract the value of “field2”:

import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;

JsonParser parser = new JsonParser();
JsonObject jsonObject = parser.parse(response).getAsJsonObject();
JsonElement jsonElement = jsonObject.get("field2");
String field2 = jsonElement.getAsString();