Here you can find the source of json2List(String json, Class
public static <T> List<T> json2List(String json, Class<T> beanClass)
//package com.java2s; //License from project: Apache License import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.ObjectMapper; import java.util.List; public class Main { private static ObjectMapper objectMapper = new ObjectMapper(); public static <T> List<T> json2List(String json, Class<T> beanClass) { try {/*from ww w.ja v a2s . c o m*/ return (List<T>) objectMapper.readValue(json, getCollectionType(List.class, beanClass)); } catch (Exception e) { e.printStackTrace(); } return null; } public static JavaType getCollectionType(Class<?> collectionClass, Class<?>... elementClasses) { return objectMapper.getTypeFactory().constructParametricType(collectionClass, elementClasses); } }