Möglichkeit 1
Maven Dependency:
<dependency> <groupId>net.sf.json-lib</groupId> <artifactId>json-lib</artifactId> <version>2.4</version> <classifier>jdk15</classifier> </dependency> |
Code:
import net.sf.json.JSONObject; import net.sf.json.JSONSerializer; ... String json = "{\"name\":\"Benny\",\"email\":\"test\\u0040bennyn.de\"}"; JSONObject object = (JSONObject) JSONSerializer.toJSON(json); String email = object.getString("email"); // test@bennyn.de |
Möglichkeit 2
Maven Dependency:
<dependency> <groupId>com.restfb</groupId> <artifactId>restfb</artifactId> <version>1.6.12</version> </dependency> |
Code:
import com.restfb.json.JsonObject; ... String json = "{\"name\":\"Benny\",\"email\":\"test\\u0040bennyn.de\"}"; JsonObject object = new JsonObject(json); String email = object.getString("email"); // test@bennyn.de |