【JAVA】Bean转Map

一、将Bean转成Map

ObjectMapper objectMapper = new ObjectMapper();
// 一定要加这个,不然会包含null的字段
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
Map params = objectMapper.convertValue(card, Map.class);

你可能感兴趣的:(JAVA,java)