PushData<Menu[]> pushData = FastJSONUtil.parsePojo(message, PushData.class);
List<Menu> menuList= JSONArray.parseArray(JSON.toJSONString(pushData.getData()), Menu.class);
menuList.forEach(e -> {
    log.info("e:{}", e);
});

关键地方是 

JSON.toJSONString(pushData.getData())把获取到的数组 实体类数据 转为String,然后转为对应的实体

其中 PushData

@Data
@NoArgsConstructor
public class PushData<T> {
    private String seqId = Long.toHexString(System.currentTimeMillis());

    private String code = "00";

    private String type = "menu";

    private T data;

    public PushData(T data) {
        super();
        this.data = data;
    }

    public PushData(String type, T data) {
        this.data = data;
        this.type = type;
    }

}

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-02
  • 2021-05-08
  • 2021-09-14
  • 2018-06-22
  • 2021-08-15
猜你喜欢
  • 2022-12-23
  • 2021-08-23
  • 2021-09-24
  • 2022-12-23
  • 2022-12-23
  • 2021-08-28
  • 2021-07-12
相关资源
相似解决方案