com.fasterxml.jackson.core.JsonParser.Feature Java Examples
The following examples show how to use
com.fasterxml.jackson.core.JsonParser.Feature.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LogicalPlanPersistence.java From Bats with Apache License 2.0 | 6 votes |
public LogicalPlanPersistence(DrillConfig conf, ScanResult scanResult, ObjectMapper mapper) { this.mapper = mapper; SimpleModule deserModule = new SimpleModule("LogicalExpressionDeserializationModule") .addDeserializer(LogicalExpression.class, new LogicalExpression.De(conf)) .addDeserializer(SchemaPath.class, new SchemaPath.De()); mapper.registerModule(deserModule); mapper.enable(SerializationFeature.INDENT_OUTPUT); mapper.configure(Feature.ALLOW_UNQUOTED_FIELD_NAMES, true); mapper.configure(JsonGenerator.Feature.QUOTE_FIELD_NAMES, true); mapper.configure(Feature.ALLOW_COMMENTS, true); mapper.setFilterProvider(new SimpleFilterProvider().setFailOnUnknownId(false)); registerSubtypes(LogicalOperatorBase.getSubTypes(scanResult)); registerSubtypes(StoragePluginConfigBase.getSubTypes(scanResult)); registerSubtypes(FormatPluginConfigBase.getSubTypes(scanResult)); }
Example #2
Source File: CoreAppConfig.java From logsniffer with GNU Lesser General Public License v3.0 | 6 votes |
@Bean public ObjectMapper jsonObjectMapper() { final ObjectMapper jsonMapper = new ObjectMapper(); jsonMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); jsonMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); jsonMapper.configure(Feature.ALLOW_UNQUOTED_FIELD_NAMES, true); jsonMapper.configure(Feature.ALLOW_SINGLE_QUOTES, true); jsonMapper.configure(MapperFeature.DEFAULT_VIEW_INCLUSION, false); final SimpleModule module = new SimpleModule("FieldsMapping", Version.unknownVersion()); module.setSerializerModifier(new BeanSerializerModifier() { @Override public JsonSerializer<?> modifyMapSerializer(final SerializationConfig config, final MapType valueType, final BeanDescription beanDesc, final JsonSerializer<?> serializer) { if (FieldsMap.class.isAssignableFrom(valueType.getRawClass())) { return new FieldsMapMixInLikeSerializer(); } else { return super.modifyMapSerializer(config, valueType, beanDesc, serializer); } } }); jsonMapper.registerModule(module); return jsonMapper; }
Example #3
Source File: JsonMapper.java From onetwo with Apache License 2.0 | 6 votes |
public JsonMapper(ObjectMapper objectMapper, Include include, boolean fieldVisibility){ objectMapper.setSerializationInclusion(include); // objectMapper.configure(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS, false); // setDateFormat(DateUtils.DATE_TIME); objectMapper.configure(Feature.ALLOW_UNQUOTED_FIELD_NAMES, true); objectMapper.configure(Feature.ALLOW_COMMENTS, true); // objectMapper.configure(Feature.ALLOW_UNQUOTED_CONTROL_CHARS, true); objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); if(fieldVisibility) objectMapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY); objectMapper.setFilterProvider(filterProvider); // objectMapper.addMixIn(target, mixinSource); this.objectMapper = objectMapper; this.typeFactory = this.objectMapper.getTypeFactory(); }
Example #4
Source File: ValidationService.java From yaml-json-validator-maven-plugin with Apache License 2.0 | 6 votes |
public ValidationService(final InputStream schemaFile, final boolean isEmptyFileAllowed, final boolean detectDuplicateKeys, final boolean allowJsonComments, final boolean allowTrailingComma) { schema = getJsonSchema(schemaFile); this.isEmptyFileAllowed = isEmptyFileAllowed; if (detectDuplicateKeys) { this.jsonMapper.enable(Feature.STRICT_DUPLICATE_DETECTION); this.yamlMapper.enable(Feature.STRICT_DUPLICATE_DETECTION); } if (allowJsonComments) { this.jsonMapper.enable(Feature.ALLOW_COMMENTS); } if (allowTrailingComma) { this.jsonMapper.enable(Feature.ALLOW_TRAILING_COMMA); this.yamlMapper.enable(Feature.ALLOW_TRAILING_COMMA); } }
Example #5
Source File: Mapping.java From logbook-kai with MIT License | 6 votes |
private Mapping() { InputStream is = PluginServices.getResourceAsStream("logbook/map/mapping.json"); Map<String, String> mapping = Collections.emptyMap(); if (is != null) { try { try { ObjectMapper mapper = new ObjectMapper(); mapper.enable(Feature.ALLOW_COMMENTS); mapping = mapper.readValue(is, new TypeReference<LinkedHashMap<String, String>>() { }); } finally { is.close(); } } catch (Exception e) { LoggerHolder.get().error("マッピングの初期化に失敗しました", e); } } this.mapping = mapping; }
Example #6
Source File: AgsClient.java From geoportal-server-harvester with Apache License 2.0 | 6 votes |
/** * Reads service information. * * @param url service URL * @return service response * @throws IOException if accessing token fails */ public ServerResponse readServiceInformation(URL url) throws IOException { HttpGet get = new HttpGet(url + String.format("?f=%s", "json")); try (CloseableHttpResponse httpResponse = httpClient.execute(get); InputStream contentStream = httpResponse.getEntity().getContent();) { if (httpResponse.getStatusLine().getStatusCode()>=400) { throw new HttpResponseException(httpResponse.getStatusLine().getStatusCode(), httpResponse.getStatusLine().getReasonPhrase()); } String responseContent = IOUtils.toString(contentStream, "UTF-8"); ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); mapper.configure(Feature.ALLOW_NON_NUMERIC_NUMBERS, true); mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); ServerResponse response = mapper.readValue(responseContent, ServerResponse.class); response.url = url.toExternalForm(); response.json = responseContent; return response; } }
Example #7
Source File: LogicalPlanPersistence.java From dremio-oss with Apache License 2.0 | 6 votes |
public LogicalPlanPersistence(SabotConfig conf, ScanResult scanResult) { mapper = new ObjectMapper(); SimpleModule deserModule = new SimpleModule("LogicalExpressionDeserializationModule") .addDeserializer(LogicalExpression.class, new LogicalExpression.De()) .addDeserializer(SchemaPath.class, new SchemaPath.De()) .addDeserializer(FieldReference.class, new FieldReference.De()); mapper.registerModule(new AfterburnerModule()); mapper.registerModule(deserModule); mapper.enable(SerializationFeature.INDENT_OUTPUT); mapper.configure(Feature.ALLOW_UNQUOTED_FIELD_NAMES, true); mapper.configure(JsonGenerator.Feature.QUOTE_FIELD_NAMES, true); mapper.configure(Feature.ALLOW_COMMENTS, true); registerSubtypes(LogicalOperatorBase.getSubTypes(scanResult)); registerSubtypes(StoragePluginConfigBase.getSubTypes(scanResult)); registerSubtypes(FormatPluginConfigBase.getSubTypes(scanResult)); }
Example #8
Source File: DataMappingService.java From vethrfolnir-mu with GNU General Public License v3.0 | 6 votes |
@Inject private void load() { if(assetManager == null) { throw new RuntimeException("AssetManaget has not been set in your setup! Mapping service cannot be performed!"); } defaultTypeFactory = TypeFactory.defaultInstance(); jsonMapper.setVisibilityChecker(jsonMapper.getDeserializationConfig().getDefaultVisibilityChecker() .withCreatorVisibility(JsonAutoDetect.Visibility.NONE) .withFieldVisibility(JsonAutoDetect.Visibility.ANY) .withGetterVisibility(JsonAutoDetect.Visibility.NONE) .withIsGetterVisibility(JsonAutoDetect.Visibility.NONE) .withSetterVisibility(JsonAutoDetect.Visibility.NONE)); jsonMapper.configure(SerializationFeature.INDENT_OUTPUT, true).configure(Feature.ALLOW_COMMENTS, true); defaultPrettyPrinter = new DefaultPrettyPrinter(); defaultPrettyPrinter.indentArraysWith(new Lf2SpacesIndenter()); }
Example #9
Source File: JsonSdlObjectMapper.java From cm_ext with Apache License 2.0 | 6 votes |
/** * We construct a new jackson object mapper for the parser since we want to * add some configuration that we don't want to apply to our global object * mapper. This object mapper has the following features: * * 1. Does not fail if there is an unknown element in the json file, by default. * It simply ignores the element and continues reading. This can be reconfigured. * * 2. We use Mr. Bean for bean materialization during deserialization. Mr Bean * uses ASM to create classes at runtime that conform to your abstract class * or interface. This allows us to define an immutable interface for the * service descriptor and not have to write out all the concrete classes. * * 3. We add mixin classes to the object mapper to let jackson know of * property name remaps. * @return */ private ObjectMapper createObjectMapper() { final Map<Class<?>, Class<?>> mixins = new HashMap<Class<?>, Class<?>>() {{ put(Parameter.class, ParameterMixin.class); put(ConfigGenerator.class, GeneratorMixin.class); put(DependencyExtension.class, DependencyExtensionMixin.class); put(PlacementRuleDescriptor.class, PlacementRuleMixin.class); put(SslServerDescriptor.class, SslServerDescriptorTypeMixin.class); put(SslClientDescriptor.class, SslClientDescriptorTypeMixin.class); }}; ObjectMapper m = new ObjectMapper(); m.registerModule(new SimpleModule() { @Override public void setupModule(SetupContext context) { for (Entry<Class<?>, Class<?>> entry : mixins.entrySet()) { context.setMixInAnnotations(entry.getKey(), entry.getValue()); } } }); m.registerModule(new MrBeanModule()); m.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); m.configure(Feature.ALLOW_COMMENTS, true); return m; }
Example #10
Source File: RestObjectMapper.java From servicecomb-java-chassis with Apache License 2.0 | 6 votes |
public RestObjectMapper() { getFactory().disable(Feature.AUTO_CLOSE_SOURCE); // Enable features that can tolerance errors and not enable those make more constraints for compatible reasons. // Developers can use validation api to do more checks. disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); disable(SerializationFeature.FAIL_ON_EMPTY_BEANS); // no view annotations shouldn't be included in JSON disable(MapperFeature.DEFAULT_VIEW_INCLUSION); disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); enable(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS); enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); SimpleModule module = new SimpleModule(); // custom types module.addSerializer(JsonObject.class, new JsonObjectSerializer()); registerModule(module); registerModule(new JavaTimeModule()); }
Example #11
Source File: JSONParseSpec.java From druid-api with Apache License 2.0 | 6 votes |
@JsonCreator public JSONParseSpec( @JsonProperty("timestampSpec") TimestampSpec timestampSpec, @JsonProperty("dimensionsSpec") DimensionsSpec dimensionsSpec, @JsonProperty("flattenSpec") JSONPathSpec flattenSpec, @JsonProperty("featureSpec") Map<String, Boolean> featureSpec ) { super(timestampSpec, dimensionsSpec); this.objectMapper = new ObjectMapper(); this.flattenSpec = flattenSpec != null ? flattenSpec : new JSONPathSpec(true, null); this.featureSpec = (featureSpec == null) ? new HashMap<String, Boolean>() : featureSpec; for (Map.Entry<String, Boolean> entry : this.featureSpec.entrySet()) { Feature feature = Feature.valueOf(entry.getKey()); objectMapper.configure(feature, entry.getValue()); } }
Example #12
Source File: TargetsCommandTest.java From buck with Apache License 2.0 | 6 votes |
@Test public void testJsonOutputForBuildTarget() throws IOException, BuildFileParseException { String targetName = "//:test-library"; // run `buck targets` on the build file and parse the observed JSON. SortedSet<TargetNode<?>> nodes = buildTargetNodes(targetName); targetsCommand.printJsonForTargets( params, executor, nodes, ImmutableSetMultimap.of( BuildTargetFactory.newInstance(targetName), OutputLabel.defaultLabel()), ImmutableMap.of(), ImmutableSet.of()); String observedOutput = console.getTextWrittenToStdOut(); JsonNode observed = ObjectMappers.READER.readTree(ObjectMappers.createParser(observedOutput)); // parse the expected JSON. String expectedJson = workspace.getFileContents("TargetsCommandTestBuckJson1.js"); JsonNode expected = ObjectMappers.READER.readTree( ObjectMappers.createParser(expectedJson).enable(Feature.ALLOW_COMMENTS)); assertEquals("Output from targets command should match expected JSON.", expected, observed); assertEquals("Nothing should be printed to stderr.", "", console.getTextWrittenToStdErr()); }
Example #13
Source File: TargetsCommandTest.java From buck with Apache License 2.0 | 6 votes |
@Test public void testJsonOutputWithDirectDependencies() throws IOException { // Run Buck targets command on a case where the deps and direct_dependencies differ ProcessResult result = workspace.runBuckCommand("targets", "--json", "//:B"); // Parse the observed JSON. JsonNode observed = ObjectMappers.READER.readTree( ObjectMappers.createParser(result.getStdout()).enable(Feature.ALLOW_COMMENTS)); // Parse the expected JSON. String expectedJson = workspace.getFileContents("TargetsCommandTestBuckJson2.js"); JsonNode expected = ObjectMappers.READER.readTree( ObjectMappers.createParser(expectedJson).enable(Feature.ALLOW_COMMENTS)); assertThat( "Output from targets command should match expected JSON.", observed, is(equalTo(expected))); assertThat( "Nothing should be printed to stderr.", console.getTextWrittenToStdErr(), is(equalTo(""))); }
Example #14
Source File: Orianna.java From orianna with MIT License | 5 votes |
private static Configuration getConfiguration(final CharSource configJSON) { final ObjectMapper mapper = new ObjectMapper().enable(Feature.ALLOW_COMMENTS); try { return mapper.readValue(configJSON.read(), Configuration.class); } catch(final IOException e) { LOGGER.error("Failed to load configuration JSON!", e); throw new OriannaException("Failed to load configuration JSON!", e); } }
Example #15
Source File: Serializers.java From proctor with Apache License 2.0 | 5 votes |
public static ObjectMapper lenient() { final ObjectMapper mapper = new ObjectMapper(); mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); mapper.configure(Feature.ALLOW_COMMENTS, true); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); final SimpleModule module = new SimpleModule(); final PlainNumericSerializer plainNumericSerializer = new PlainNumericSerializer(); module.addSerializer(double.class, plainNumericSerializer); module.addSerializer(Double.class, plainNumericSerializer); module.registerSubtypes(DynamicFilters.getFilterTypes()); mapper.registerModule(module); return mapper; }
Example #16
Source File: Serializers.java From proctor with Apache License 2.0 | 5 votes |
/** * @return an {@link ObjectMapper} configured to do things as we want */ @Nonnull public static ObjectMapper strict() { final ObjectMapper mapper = new ObjectMapper(); mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); mapper.configure(Feature.ALLOW_COMMENTS, true); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true); final SimpleModule module = new SimpleModule(); final PlainNumericSerializer plainNumericSerializer = new PlainNumericSerializer(); module.addSerializer(double.class, plainNumericSerializer); module.addSerializer(Double.class, plainNumericSerializer); module.registerSubtypes(DynamicFilters.getFilterTypes()); mapper.registerModule(module); return mapper; }
Example #17
Source File: BulkLoadFromJdbcWithJoins.java From java-client-api with Apache License 2.0 | 5 votes |
public Employee parseEmployee(ResultSet row) throws SQLException { try { ObjectMapper mapper = new ObjectMapper() .configure(Feature.ALLOW_UNQUOTED_FIELD_NAMES, true); return mapper.readValue(row.getString(1), Employee.class); } catch (Exception exception) { exception.printStackTrace(); throw new RuntimeException(exception); } }
Example #18
Source File: ParserMinimalBase.java From openbd-core with GNU General Public License v3.0 | 5 votes |
protected char _handleUnrecognizedCharacterEscape(char ch) throws JsonProcessingException { // as per [JACKSON-300] if (isEnabled(Feature.ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER)) { return ch; } // and [JACKSON-548] if (ch == '\'' && isEnabled(Feature.ALLOW_SINGLE_QUOTES)) { return ch; } _reportError("Unrecognized character escape "+_getCharDesc(ch)); return ch; }
Example #19
Source File: ParserMinimalBase.java From openbd-core with GNU General Public License v3.0 | 5 votes |
/** * Method called to report a problem with unquoted control character. * Note: starting with version 1.4, it is possible to suppress * exception by enabling {@link Feature#ALLOW_UNQUOTED_CONTROL_CHARS}. */ protected void _throwUnquotedSpace(int i, String ctxtDesc) throws JsonParseException { // JACKSON-208; possible to allow unquoted control chars: if (!isEnabled(Feature.ALLOW_UNQUOTED_CONTROL_CHARS) || i > INT_SPACE) { char c = (char) i; String msg = "Illegal unquoted character ("+_getCharDesc(c)+"): has to be escaped using backslash to be included in "+ctxtDesc; _reportError(msg); } }
Example #20
Source File: Missions.java From logbook-kai with MIT License | 5 votes |
/** * 遠征IDから{@link MissionCondition}を返します。 * * @param missionId 遠征ID * @return {@link MissionCondition} * @throws IOException */ public static Optional<MissionCondition> getMissionCondition(Integer missionId) throws IOException { Mission mission = Missions.getMission(missionId); if (mission == null) { return Optional.empty(); } if ("前衛支援任務".equals(mission.getName())) { mission = Missions.getMission(33); } else if ("艦隊決戦支援任務".equals(mission.getName())) { mission = Missions.getMission(34); } InputStream is = PluginServices .getResourceAsStream("logbook/mission/" + mission.getMapareaId() + "/" + mission.getDispNo() + ".json"); if (is == null) { return Optional.empty(); } MissionCondition condition; try { ObjectMapper mapper = new ObjectMapper(); mapper.enable(Feature.ALLOW_COMMENTS); condition = mapper.readValue(is, MissionCondition.class); } finally { is.close(); } return Optional.ofNullable(condition); }
Example #21
Source File: TargetsCommandTest.java From buck with Apache License 2.0 | 5 votes |
@Test public void testJsonOutputWithOutputAttributes() throws IOException { ProcessResult result = workspace.runBuckCommand( "targets", "--json", "//:B", "--output-attributes", "buck.direct_dependencies", "fully_qualified_name"); // Parse the observed JSON. JsonNode observed = ObjectMappers.READER.readTree( ObjectMappers.createParser(result.getStdout()).enable(Feature.ALLOW_COMMENTS)); // Parse the expected JSON. String expectedJson = workspace.getFileContents("TargetsCommandTestBuckJson2Filtered.js"); JsonNode expected = ObjectMappers.READER.readTree( ObjectMappers.createParser(expectedJson).enable(Feature.ALLOW_COMMENTS)); assertThat( "Output from targets command should match expected JSON.", observed, is(equalTo(expected))); assertThat( "Nothing should be printed to stderr.", console.getTextWrittenToStdErr(), is(equalTo(""))); }
Example #22
Source File: JMAPApiRoutes.java From james-project with Apache License 2.0 | 5 votes |
@Inject public JMAPApiRoutes(RequestHandler requestHandler, MetricFactory metricFactory, @Named(InjectionKeys.DRAFT) Authenticator authenticator, UserProvisioner userProvisioner, DefaultMailboxesProvisioner defaultMailboxesProvisioner) { this.requestHandler = requestHandler; this.metricFactory = metricFactory; this.authenticator = authenticator; this.userProvisioner = userProvisioner; this.defaultMailboxesProvisioner = defaultMailboxesProvisioner; this.objectMapper = new ObjectMapper(); objectMapper.configure(Feature.ALLOW_UNQUOTED_CONTROL_CHARS, true); }
Example #23
Source File: AbstractDynamicBean.java From Bats with Apache License 2.0 | 5 votes |
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; }
Example #24
Source File: JacksonXmlMapperTest.java From onetwo with Apache License 2.0 | 5 votes |
@Before public void setup(){ // objectMapper.configure(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS, false); objectMapper.configure(Feature.ALLOW_UNQUOTED_FIELD_NAMES, true); objectMapper.configure(Feature.ALLOW_SINGLE_QUOTES, true); // objectMapper.configure(org.codehaus.jackson.map.DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); }
Example #25
Source File: JsonUtil.java From besu with Apache License 2.0 | 5 votes |
public static ObjectNode objectNodeFromString( final String jsonData, final boolean allowComments) { final ObjectMapper objectMapper = new ObjectMapper(); objectMapper.configure(Feature.ALLOW_COMMENTS, allowComments); try { final JsonNode jsonNode = objectMapper.readTree(jsonData); validateType(jsonNode, JsonNodeType.OBJECT); return (ObjectNode) jsonNode; } catch (final IOException e) { // Reading directly from a string should not raise an IOException, just catch and rethrow throw new RuntimeException(e); } }
Example #26
Source File: ParserMinimalBase.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Method called to report a problem with unquoted control character. * Note: starting with version 1.4, it is possible to suppress * exception by enabling {@link Feature#ALLOW_UNQUOTED_CONTROL_CHARS}. */ protected void _throwUnquotedSpace(int i, String ctxtDesc) throws JsonParseException { // JACKSON-208; possible to allow unquoted control chars: if (!isEnabled(Feature.ALLOW_UNQUOTED_CONTROL_CHARS) || i > INT_SPACE) { char c = (char) i; String msg = "Illegal unquoted character ("+_getCharDesc(c)+"): has to be escaped using backslash to be included in "+ctxtDesc; _reportError(msg); } }
Example #27
Source File: ParserMinimalBase.java From lams with GNU General Public License v2.0 | 5 votes |
protected char _handleUnrecognizedCharacterEscape(char ch) throws JsonProcessingException { // as per [JACKSON-300] if (isEnabled(Feature.ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER)) { return ch; } // and [JACKSON-548] if (ch == '\'' && isEnabled(Feature.ALLOW_SINGLE_QUOTES)) { return ch; } _reportError("Unrecognized character escape "+_getCharDesc(ch)); return ch; }
Example #28
Source File: JsonMapper.java From jeesuite-libs with Apache License 2.0 | 5 votes |
public JsonMapper(Include include) { mapper = new ObjectMapper(); //设置输出时包含属性的风格 if (include != null) { mapper.setSerializationInclusion(include); } //设置输入时忽略在JSON字符串中存在但Java对象实际没有的属性 mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); // mapper.configure(Feature.ALLOW_UNQUOTED_FIELD_NAMES, false); }
Example #29
Source File: JsonMapperTest.java From onetwo with Apache License 2.0 | 5 votes |
@Before public void setup(){ // objectMapper.configure(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS, false); objectMapper.configure(Feature.ALLOW_UNQUOTED_FIELD_NAMES, true); objectMapper.configure(Feature.ALLOW_SINGLE_QUOTES, true); // objectMapper.configure(org.codehaus.jackson.map.DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); }
Example #30
Source File: AbstractDynamicBean.java From dremio-oss with Apache License 2.0 | 5 votes |
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; }