TypeReference -- 让Jackson Json在List/Map中识别自己的Object

private Map<String, Object> buildHeaders(Object params) {
        ObjectMapper objectMapper = JacksonHelper.getMapper();
        return objectMapper.convertValue(params, new TypeReference<Map<String, Object>>(){});
}    

参考How to use Jackson to deserialise an array of objects

posted @ 2018-04-02 19:40  hjzqyx  阅读(4307)  评论(2编辑  收藏  举报