Here you can find the source of toList(String json, Class
@SuppressWarnings("unchecked") public static <T> List<T> toList(String json, Class<T> clz)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.List; import com.fasterxml.jackson.databind.ObjectMapper; public class Main { @SuppressWarnings("unchecked") public static <T> List<T> toList(String json, Class<T> clz) { return (List<T>) readValue(json, clz); }/*from ww w . ja v a 2 s.c o m*/ public static <T> T readValue(String jsonStr, Class<T> valueType) { ObjectMapper objectMapper = new ObjectMapper(); objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")); try { return objectMapper.readValue(jsonStr, valueType); } catch (Exception e) { e.printStackTrace(); } return null; } }