Questions tagged [jackson-databind]

Use this tag for questions related to jackson-databind library providing the data-binding functionality and tree-model for Jackson.

Jackson-databind is a library providing the general-purpose data-binding functionality and tree-model for Jackson Data Processor.

See github project for brief introductionary tutorials, in recommended order of reading. More comprehensive documentation can be found from Jackson-docs repository; as well as from Wiki of this project.

1230 questions
84
votes
10 answers

How to convert JSON string into List of Java object?

This is my JSON Array :- [ { "firstName" : "abc", "lastName" : "xyz" }, { "firstName" : "pqr", "lastName" : "str" } ] I have this in my String object. Now I want to convert it into Java object…
Nitesh
  • 1,477
  • 5
  • 23
  • 34
42
votes
5 answers

Lombok 1.18.0 and Jackson 2.9.6 not working together

The deserialization is failing after the update. I updated my micro-service from Spring 1.5.10.RELEASE to Spring 2.0.3.RELEASE and also updated the lombok from 1.16.14 to 1.18.0 and jackson-datatype-jsr310 from 2.9.4 to 2.9.6. The JSON string…
JHS
  • 7,761
  • 2
  • 29
  • 53
42
votes
9 answers

Immutable Lombok annotated class with Jackson

What is the preferred way to create class that is Immutable Can be serialized/deserialized with Jackson Human-readable and with low level of boilerplate Preferably, I would have liked something like this to work: @Data(onConstructor =…
Christian Neverdal
  • 5,655
  • 6
  • 38
  • 93
41
votes
1 answer

Cannot deserialize value of type `java.util.Date` from String

Using Spring 1.5.8.RELEASE Jackson mapper giving the following exception. Cannot deserialize value of type `java.util.Date` from String "2018-09-04T10:44:46": expected format "yyyy-MM-dd'T'HH:mm:ss.SSS" at [Source: UNKNOWN; line: -1, column: -1]…
Utkarsh Gandhi
  • 617
  • 2
  • 6
  • 13
24
votes
1 answer

com.fasterxml.jackson.databind.exc.MismatchedInputException: Can not deserialize instance of object out of START_ARRAY token

Getting the MismatchedInputException. Searched a lot of questions here but found JSONMappingException mostly. I don't understand if they are same or different. Following is the entity: @Entity @Table @NamedQueries({ …
priyanka singh
  • 243
  • 1
  • 2
  • 4
23
votes
3 answers

ObjectMapper - Best practice for thread-safety and performance

Summary I want to find the best practice for using ObjectMapper and/or ObjectReader in terms of thread-safety and performance in the context of the use-case described below. Background I have a helper class (Json.java) where the method toObject()…
axeleration
  • 233
  • 1
  • 2
  • 5
21
votes
4 answers

Catching & Handling Jackson Exceptions with a custom message

I'm hoping to to catch some jackson exceptions that are occurring in a spring-boot API I am developing. For example, I have the following request class and I want to catch the error that occurs when the "questionnaireResponse" key in the JSON…
Funsaized
  • 1,972
  • 4
  • 21
  • 41
20
votes
4 answers

Lombok builder pattern with jackson JsonProperty

I have constructed a Java Object using lombok with builder pattern. But, I am getting the following exception when trying to deserialize a Java object using Jackson. This occurs for fields which has @JsonProperty annotation. Exception in thread…
suraj1291993
  • 474
  • 1
  • 5
  • 15
19
votes
4 answers

Jackson, deserialize class with private fields and arg-constructor without annotations

It is possible to deserialize to a class with private fields and a custom argument constructor without using annotations and without modifying the class, using Jackson? I know it's possible in Jackson when using this combination: 1) Java 8, 2)…
Devabc
  • 4,782
  • 5
  • 27
  • 40
16
votes
2 answers

nested exception is java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/ser/std/ToStringSerializerBase

current version jackson-databind-2.9.10.1.jar need to upgrade jackson-databind-2.11.1.jar I could not find ToStringSerializerBase class in new version of jackson updated jar org.springframework.beans.BeanInstantiationException: Failed…
ssp
  • 294
  • 1
  • 3
  • 7
14
votes
1 answer

Get the detected generic type inside Jackson's JsonDeserializer

For external reasons, all java Maps in my system can only be received as lists of key-value pairs from the clients, e.g. a Map will actually be received as Json-serialized List>. This means I need to customize my…
kaqqao
  • 12,984
  • 10
  • 64
  • 118
13
votes
2 answers

ObjectMapper enable method is deprecated

I'm upgrading the version of my project and I am currently using jackson-databind-2.13.0 .But I noticed that ObjectMapper's enable method is deprecated. They said to use it like this instead. @deprecated Since 2.13 use {@code…
Sezer Aydın
  • 187
  • 1
  • 2
  • 10
11
votes
1 answer

java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/TSFBuilder

I'm using maven and dropwizard, getting java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/TSFBuilder error when I initiate an Object Mapper. Tried to override the dependency by adding com.fasterxml.jackson.core version 2.10.0 to POM (also…
roe
  • 299
  • 1
  • 3
  • 10
10
votes
2 answers

Deserialize flat array in XML by Jackson to List of Pojo

Can you help me to parse the following XML file? 2017-10-25T09:13:54+02:00 1 Stuart 34
Denis Stephanov
  • 4,563
  • 24
  • 78
  • 174
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
1
2 3
81 82