Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

objectmapper in java 8

public static <T> List<T> mapPayloadListToPOJOList(List<String> payloadList, Class<T> pojo) throws IOException {
    ObjectMapper mapper = new ObjectMapper();
    List<T> pojoList = new ArrayList<>();
    for (String payload : payloadList) {
        T mapped = mapper.readValue(payload, pojo);
        pojoList.add(mapped);
    }
    return pojoList;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #objectmapper #java
ADD COMMENT
Topic
Name
5+8 =