jackson-modules

Using jackson-dataformat-xml on android

青春壹個敷衍的年華 提交于 2019-11-29 07:16:28
I'm strugling with using jackson-dataformat-xml on android I have some very basic code that works fine on oracle jre JacksonXmlModule module = new JacksonXmlModule(); module.setDefaultUseWrapper(false); XmlMapper xmlMapper = new XmlMapper(module); First I tried official documentation adapted for gradle (by me, not sure if done correctly): compile 'com.fasterxml.jackson.core:jackson-core:2.5.4' compile 'com.fasterxml.jackson.core:jackson-annotations:2.5.4' compile 'com.fasterxml.jackson.core:jackson-databind:2.5.4' compile 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.5.4' compile

set Jackson ObjectMapper class not to use scientific notation for double

空扰寡人 提交于 2019-11-28 12:14:27
I am using a library com.fasterxml.jackson library for JsonSchema, I am creating creating an IntegerSchema object, when I set range for integer schema using below code: main(){ IntegerSchema intSchema = new IntegerSchema(); // setMaximum accepts Double object intSchema.setMaximum(new Double(102000000)); // setMaximum accepts Double object intSchema.setMinimum(new Double(100)); printJsonSchema(intSchema); } public void printJsonSchema(JsonSchema schema){ ObjectMapper mapper = new ObjectMapper(); try { logger.info(mapper.writeValueAsString(schema)); } catch (JsonProcessingException e) { throw

Register JodaModule in Jax-RS Application

那年仲夏 提交于 2019-11-28 08:52:00
问题 I'm writing a Jax-RS application using Jersey, and Jackson2 under the hood to facilitate JSON i/o. The service itself works fine, but I'd like to improve it by having the Jackson mapper automagically serialize/deserialize date and date-times to JodaTime objects. I'm following the documentation here and have added the relevant jars, but I'm lost on this instruction: Registering module To use Joda datatypes with Jackson, you will first need to register the module first (same as with all Jackson

Spring RestTemplate with Jackson as HttpMessageConverter and joda DateTime property fails to deserialize

吃可爱长大的小学妹 提交于 2019-11-28 08:30:56
The scenario is as follows. I have an ObjectMapper (Jackson 2) that registers a JodaModule, capable of serializing and de-serializing Joda DateTime type. This ObjectMapper is tested with custom JSON strings and works as expected. ObjectMapper objectMapper = new ObjectMapper(); objectMapper.registerModule(new JodaModule()); objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); objectMapper.setTimeZone(TimeZone.getTimeZone("GMT+1:00")); objectMapper.setDateFormat(new ISO8601DateFormat()); objectMapper.enable(SerializationFeature.INDENT_OUTPUT); objectMapper.configure

Jackson JSON deserialization with multiple parameters constructor

混江龙づ霸主 提交于 2019-11-27 23:23:46
问题 I've been using FasterXML/Jackson-Databind in my project for a while now, and all was working great, until I've discovered this post and started to use this approach to desserialize objects without the @JsonProperty annotations. The problem is that when I have a constructor which take multiple parameters and decorate this constructor with the @JsonCreator annotation Jackson throw the following error: Exception in thread "main" com.fasterxml.jackson.databind.JsonMappingException: Argument #0

Spring RestTemplate with Jackson as HttpMessageConverter and joda DateTime property fails to deserialize

只谈情不闲聊 提交于 2019-11-27 02:22:54
问题 The scenario is as follows. I have an ObjectMapper (Jackson 2) that registers a JodaModule, capable of serializing and de-serializing Joda DateTime type. This ObjectMapper is tested with custom JSON strings and works as expected. ObjectMapper objectMapper = new ObjectMapper(); objectMapper.registerModule(new JodaModule()); objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); objectMapper.setTimeZone(TimeZone.getTimeZone("GMT+1:00")); objectMapper.setDateFormat(new

Is there a jackson datatype module for JDK8 java.time?

[亡魂溺海] 提交于 2019-11-26 22:31:54
I'm looking for a module for the new JDK8 java.time classes. I have looked through the FasterXML GitHub Project Listing and presently found none. As I understand Jackson is still being compiled against JDK6 so can not use these classes directly and must have this built as a separate module, as was required with Joda. I don't mind starting the project, though looking to see if any other efforts were already underway. As already mentioned, Jackson-Datatype-JSR310 provides support for Java 8 Time. Since Jackson 2.6.0 the "old" JSR310Module is deprecated. It is replaced by JavaTimeModule. Maven

Is there a jackson datatype module for JDK8 java.time?

时间秒杀一切 提交于 2019-11-26 07:41:35
问题 I\'m looking for a module for the new JDK8 java.time classes. I have looked through the FasterXML GitHub Project Listing and presently found none. As I understand Jackson is still being compiled against JDK6 so can not use these classes directly and must have this built as a separate module, as was required with Joda. I don\'t mind starting the project, though looking to see if any other efforts were already underway. 回答1: As already mentioned, Jackson-Datatype-JSR310 provides support for