Stack Exchange
Json parsing using Simple json library
 import org.json.simple.JSONObject;
import org.json.simple.JSONValue;
String Json = {"AccountToken":{"string":"hello"},"Event":{"string":"t"}}
JSONObject genreJsonObject =(JSONObject)JSONValue.parseWithException(json);
String account_id = (String) genreJsonObject.get("AccountToken");

Throws java.lang.ClassCastException error
What could be wrong please help?

for instance the fact that the content of AccountToken is not a String ?

if AccountToken is also jsonObject, how will code change?

AccountToken is not a string.

AccountToken is an JSON object, not a String...
You'll need to cast it to JSONObject and call get() on it again to get a value from its internal structure
String json = "{\"AccountToken\":{\"string\":\"hello\"},\"Event\":{\"string\":\"t\"}}";
JSONObject genreJsonObject =(JSONObject)JSONValue.parseWithException(json);
JSONObject accountToken = (JSONObject) genreJsonObject.get("AccountToken");
System.out.println(accountToken.get("string"));

==> hello

