Example usage for com.fasterxml.jackson.datatype.joda JodaMapper readValue

List of usage examples for com.fasterxml.jackson.datatype.joda JodaMapper readValue

Introduction

In this page you can find the example usage for com.fasterxml.jackson.datatype.joda JodaMapper readValue.

Prototype

@Override
@SuppressWarnings("unchecked")
public <T> T readValue(JsonParser jp, Class<T> valueType)
        throws IOException, JsonParseException, JsonMappingException 

Source Link

Document

Method to deserialize JSON content into a non-container type (it can be an array type, however): typically a bean, array or a wrapper type (like java.lang.Boolean ).

Usage

From source file:DataTools.ConvertObjectToJson.java

public static <R> R convertToObject(String json, Class<R> type) {
    R mapped = null;// w  w w .ja va2  s  . co  m
    JodaMapper mapper = new JodaMapper();
    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
            .configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, true);
    try {
        mapped = mapper.readValue(json, type);
    } catch (IOException e) {
        e.printStackTrace();
    }
    return mapped;
}