Here you can find the source of jsonToObject(String json, Class
public static <T> T jsonToObject(String json, Class<T> toValueType)
//package com.java2s; //License from project: Apache License import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.ObjectMapper; public class Main { private static ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL); public static <T> T jsonToObject(String json, Class<T> toValueType) { if (json == null) { return null; }/*www . j a v a 2 s. c o m*/ try { return objectMapper.readValue(json, toValueType); } catch (Exception e) { throw new RuntimeException("json to object failed :" + e.getMessage()); } } }