//要用到com.alibaba.fastjson依赖 Object o = query.get(0); String s = JSON.toJSONString(o); TgSession tgSession = JSON.parseObject(s, TgSession.class);