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  胡峻峥  阅读(3092)  评论(2编辑  收藏