I am new to java, and I am trying to create a json string with name and value.    
public static String serializeToken(String name,String value){
    JsonObject json = new JsonObject();
    json.addProperty(name, value);
    return json.getAsString();
}
But the call to getAsString throws an exception and message is just:
JsonObject
 
    