Refine search
public MappingJackson2MessageConverter() { this.objectMapper = new ObjectMapper(); this.objectMapper.configure(MapperFeature.DEFAULT_VIEW_INCLUSION, false); this.objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); }
private ObjectMapper initObjectMapper() { ObjectMapper objectMapper = new ObjectMapper(); objectMapper.configure(MapperFeature.DEFAULT_VIEW_INCLUSION, false); objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); return objectMapper; }
public static ObjectMapper create() { ObjectMapper mapper = new ObjectMapper(); // forward compatibility for the properties may go away in the future mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true); mapper.configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, false); mapper.setSerializationInclusion(Include.NON_NULL); return mapper; }
public static ObjectMapper create() { ObjectMapper mapper = new ObjectMapper(); // forward compatibility for the properties may go away in the future mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); mapper.configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, true); mapper.setSerializationInclusion(Include.NON_NULL); return mapper; }
static ObjectMapper createMapper() { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); return mapper; }
@Configuration public class JacksonConfiguration { @Bean public ObjectMapper objectMapper() { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); mapper.configure(MapperFeature.DEFAULT_VIEW_INCLUSION, true); return mapper; } }
public JsonOutputter() { mapper = new ObjectMapper(); mapper.configure(SerializationFeature.WRITE_ENUMS_USING_TO_STRING, true); mapper.configure(SerializationFeature.INDENT_OUTPUT, true); mapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE); }
private static ObjectMapper objectMapper() { final ObjectMapper om = new ObjectMapper(); om.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); om.configure(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES, false); om.configure(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES, false); om.setSerializationInclusion(Include.NON_NULL); om.setSerializationInclusion(Include.NON_EMPTY); return om; }
public DirectoryManager(ReplicatedJedisPool redisPool) { this.redisPool = redisPool; this.objectMapper = new ObjectMapper(); this.objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); }
public static ObjectMapper createYaml() { ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); // forward compatibility for the properties may go away in the future mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); mapper.configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, true); mapper.setSerializationInclusion(Include.NON_NULL); return mapper; }
private static synchronized ObjectMapper getMapper(){ if(MAPPER == null){ ObjectMapper mapper = new ObjectMapper(); mapper.enable(SerializationFeature.INDENT_OUTPUT); mapper.configure(Feature.ALLOW_UNQUOTED_FIELD_NAMES, true); mapper.configure(Feature.ALLOW_COMMENTS, true); MAPPER = mapper; } return MAPPER; } }
public BanoGeocoder() { mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); }
public JacksonJSONAdapter() { mapper = new ObjectMapper(); // 忽略多余的字段 mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); // 不输出为空的字段 mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); }
public JacksonJSONAdapter() { mapper = new ObjectMapper(); // 忽略多余的字段 mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); // 不输出为空的字段 mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); }
RuntimeStatsPersister() { om = new ObjectMapper(); om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); om.configure(SerializationFeature.INDENT_OUTPUT, true); om.configure(MapperFeature.REQUIRE_SETTERS_FOR_GETTERS, true); }
String x = "{'candidateId':'k','candEducationId':1,'activitiesSocieties':'Activities for cand1'}"; ObjectMapper mapper = new ObjectMapper(); mapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); JsonNode df = mapper.readValue(x, JsonNode.class); System.out.println(df.toString()); // output: {"candidateId":"k","candEducationId":1,"activitiesSocieties":"Activities for cand1"}
@Override public ObjectMapper get() { final ObjectMapper objectMapper = new ObjectMapper(); objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); objectMapper.configure(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES, false); objectMapper.configure(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES, false); objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); objectMapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY); objectMapper.registerModule(new JsonProtoModule()); return objectMapper; } }
public String serialize(Object obj, boolean pretty) { ObjectMapper mapper = new ObjectMapper(); mapper.configure(SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS, false); if (pretty) { return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(obj); } return mapper.writeValueAsString(obj); }
private static ObjectMapper createObjectMapper() { ObjectMapper mapper = new ObjectMapper(); mapper.setDateFormat(new SimpleDateFormat("MM/dd/yyyy")); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); mapper.configure(com.fasterxml.jackson.core.JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true); return mapper; }
public ObjectMapper getContext(Class<?> type) { return new ObjectMapper() .setPropertyNamingStrategy(PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES) .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) .configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, true); } }