use of com.fasterxml.jackson.datatype.jsr310.JavaTimeModule in project ratpack by ratpack.
the class DefaultConfigDataBuilder method newDefaultObjectMapper.
public static ObjectMapper newDefaultObjectMapper() {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
objectMapper.registerModule(new Jdk8Module());
objectMapper.registerModule(new GuavaModule());
objectMapper.registerModule(new JavaTimeModule());
JsonFactory factory = objectMapper.getFactory();
factory.enable(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES);
factory.enable(JsonParser.Feature.ALLOW_SINGLE_QUOTES);
return objectMapper;
}
use of com.fasterxml.jackson.datatype.jsr310.JavaTimeModule in project data-transfer-project by google.
the class ObjectMapperFactory method createObjectMapper.
public static ObjectMapper createObjectMapper() {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.registerModule(new JavaTimeModule());
return objectMapper;
}
use of com.fasterxml.jackson.datatype.jsr310.JavaTimeModule in project tutorials by eugenp.
the class TestUtil method convertObjectToJsonBytes.
/**
* Convert an object to JSON byte array.
*
* @param object
* the object to convert
* @return the JSON byte array
* @throws IOException
*/
public static byte[] convertObjectToJsonBytes(Object object) throws IOException {
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
JavaTimeModule module = new JavaTimeModule();
mapper.registerModule(module);
return mapper.writeValueAsBytes(object);
}
use of com.fasterxml.jackson.datatype.jsr310.JavaTimeModule in project tutorials by eugenp.
the class TestUtil method convertObjectToJsonBytes.
/**
* Convert an object to JSON byte array.
*
* @param object
* the object to convert
* @return the JSON byte array
* @throws IOException
*/
public static byte[] convertObjectToJsonBytes(Object object) throws IOException {
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
JavaTimeModule module = new JavaTimeModule();
mapper.registerModule(module);
return mapper.writeValueAsBytes(object);
}
use of com.fasterxml.jackson.datatype.jsr310.JavaTimeModule in project cetc by DiscoverForever.
the class TestUtil method convertObjectToJsonBytes.
/**
* Convert an object to JSON byte array.
*
* @param object
* the object to convert
* @return the JSON byte array
* @throws IOException
*/
public static byte[] convertObjectToJsonBytes(Object object) throws IOException {
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
JavaTimeModule module = new JavaTimeModule();
mapper.registerModule(module);
return mapper.writeValueAsBytes(object);
}
Aggregations