Questions tagged [jackson-modules]
177 questions
87
votes
6 answers
Is there a jackson datatype module for JDK8 java.time?
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…

Brett Ryan
- 26,937
- 30
- 128
- 163
57
votes
4 answers
Generate JSON schema from Java class
I have a POJO class:
public class Stock {
int id;
String name;
Date date;
}
Are there any annotations or development framework/API that can convert POJO to JSON schema like below:
{"id":
{
"type" : "int"
…

user3587174
- 661
- 3
- 8
- 13
35
votes
6 answers
Jackson JSON deserialization with multiple parameters constructor
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…

pedrostanaka
- 711
- 1
- 9
- 16
24
votes
6 answers
set Jackson ObjectMapper class not to use scientific notation for double
I am using a library com.fasterxml.jackson library for JsonSchema,
I am creating an IntegerSchema object, when I set range for integer schema using below code:
main(){
IntegerSchema intSchema = new IntegerSchema();
// setMaximum accepts…

Abhij
- 1,222
- 4
- 19
- 37
20
votes
3 answers
Jackson , java.time , ISO 8601 , serialize without milliseconds
I'm using Jackson 2.8 and need to communicate with an API that doesn't allow milliseconds within ISO 8601 timestamps.
The expected format is this: "2016-12-24T00:00:00Z"
I'm using Jackson's JavaTimeModule with WRITE_DATES_AS_TIMESTAMPS set to…

Benjamin M
- 23,599
- 32
- 121
- 201
15
votes
1 answer
Jackson desrialize when JsonProperty is sometimes array and sometimes a single Object
I've searched Stack Overflow before posting, but there were no solutions for Jackson.
Here is a server response:
{
"ok": true,
"result": [
{
"update_id": 489881731,
//rest
},
{
"update_id": 489881732,
//rest
…

Alireza Mohamadi
- 751
- 1
- 6
- 22
15
votes
3 answers
Generate Json Schema from POJO with a twist
What I have:
I'm generating a JSON schema from a pojo. My code to generate the schema looks like so:
ObjectMapper mapper = new ObjectMapper();
TitleSchemaFactoryWrapper visitor = new…

StormeHawke
- 5,987
- 5
- 45
- 73
15
votes
5 answers
jackson - do not serialize lazy objects
I have an entity:
@Entity
public class Book {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
@Column
private String title;
@OneToMany(fetch = FetchType.LAZY, mappedBy = ("movie"),cascade =…

lorraine batol
- 6,001
- 16
- 55
- 114
14
votes
2 answers
Spring RestTemplate with Jackson as HttpMessageConverter and joda DateTime property fails to deserialize
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…

Spase Markovski
- 653
- 1
- 8
- 22
12
votes
3 answers
How to make sure Spring Boot extra Jackson modules are of same version?
Spring Boot already contains the core Jackson dependency + several others.
If you e.g. want to add the org.json or jsr-353 databinding modules you to explicitly define the vesion of these additional modules.
Is there a way to refer to the same…

Marcel Overdijk
- 11,041
- 17
- 71
- 110
11
votes
2 answers
Using Jackson in Jersey with multiple configured ObjectMappers
Is it possible to setup Jersey using Jackson for serialization/deserialization using multiple configured ObjectMappers?
What I would like to be able to do is register a "default" Jackson ObjectMapper and then have the ability to register another…

cmatthews.dickson
- 687
- 2
- 8
- 17
10
votes
4 answers
ObjectMapper configuation for Java 8 Time API
We're migrating from Joda to Java Time. Currently we use DateTime of Joda in our entity. AFAIK DateTime is equivalent to two types in Java: OffsetDateTime and ZonedDateTime. Since we're going to persist them in DB, we're gonna use OffsetDateTime…

Rad
- 4,292
- 8
- 33
- 71
10
votes
2 answers
How can I loosen up the naming strategy when deserializing using Jackson?
I've been trying to upgrade the JSON modules to use the FasterXML (2.6.3) versions of Jackson instead of the old Codehaus modules. During the upgrade, I've noticed that the naming strategy differs when using FasterXML instead of Codehaus.
Codehaus…

Mridang Agarwalla
- 43,201
- 71
- 221
- 382
9
votes
1 answer
Jackson JavaTimeModule not found even after adding jackson-modules-java8 dependency?
NOT A DUPLICATE -- I'm trying to follow the solutions given in Is there a jackson datatype module for JDK8 java.time? (it is the cause of this question, not a duplicate).
I added
com.fasterxml.jackson.module
…

Alex R
- 11,364
- 15
- 100
- 180
9
votes
3 answers
Using jackson-dataformat-xml on android
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…

Aksel Willgert
- 11,367
- 5
- 53
- 74