//use JsonParser; for example: JsonObject o = JsonParser.parseString("{"a": "A"}").getAsJsonObject();
User user= gson.fromJson(jsonInString, User.class); // where jsonInString is your json {"userId":"1","userName":"Yasir"}