UserModel userObj = new UserModel();
HashMap map = new HashMap();
ArrayList array = new ArrayList();
array.add(userObj);
map.put(userObj.getClass().getName(), array);
Gson gson = new Gson();
String json = gson.toJson(map);
System.out.println(json);
and it output: {"com.vlee.ejb.UserModel":[{"pkid":1001,"name":"ABC"}]}