Questions tagged [jackson]

Jackson is a Java library for handling tasks like reading and writing (parsing / generating) and data binding to/from Java objects. Although primarily used for JSON, Jackson also supports many other data formats such as Avro, CBOR, CSV, Java Properties, Protobuf, Smile, XML and YAML.

Jackson is a Java serialization and deserialization API typically used for reading and writing JSON, although other data formats such as Avro, CBOR, CSV, Java Properties, Protobuf, Smile, XML, and YAML are also supported. It offers multiple processing modes including "streaming", "data-binding" and "tree model"; of these, latter two builds on streaming processing.

The Jackson homepage is hosted on GitHub, and the project's Wiki is here.

Alternatives

Alternative Java-to-JSON binding solutions with similar APIs include FastJSON, Google Gson, and svenson. Yet more Java-to-JSON libraries are listed at json.org.

Performance

The latest performance benchmarks for these and other JSON serialization and deserialization solutions for Java are available online.

16401 questions
6
votes
1 answer

How solve bidirectional relationships on JSONB serialization?

I'm trying to serialize an entity with have a bidirectional relationship: class TypeA { String name; TypeB typeB; } class TypeB { String identifier; TypeA typeA; } With Jackson I solve with @JsonBackReference in typeB attribute and…
Emerson
  • 428
  • 5
  • 16
6
votes
2 answers

com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found

Getting error, com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class com.app.server.data.MyUser and no properties discovered to create BeanSerializer (to avoid exception, disable…
Sazzad Hissain Khan
  • 37,929
  • 33
  • 189
  • 256
6
votes
5 answers

Java 14 records json serialization

Currently experimenting with the Records implements from java 14, everything looks nice but since the accessors are slightly different and jackson is not being able to deserialize and giving the following error: Caused by:…
curiousdev
  • 69
  • 1
  • 4
6
votes
0 answers

After spring/jackson-databind minor upgrade HttpMessageConverter no longer working

I had to upgrade several packages to pass a whitesource security scan and now that the dependencies are upgraded the custom HttpMessageConverter that was intercepting and building the response previously is no longer working. The relevant…
thurmc
  • 495
  • 1
  • 8
  • 29
6
votes
2 answers

@JsonManagedReference and @JsonBackReference cannot get relation data from jsonbackreference model

i have a relationship from user and role where role have "one to many" relation and user have "many to one" relation with column "role_id" when i use relationship on spring boot i got infinite loop data when i use @OneToMany and @ManyToOne so i…
Rizal Sidik
  • 979
  • 6
  • 17
6
votes
3 answers

Webclient + Jackson: how to setup deserialization to convert snake_case into camelCase?

I'd like to avoid having to prefix my attributes with @JsonProperty("property_name") and instead just setup the Spring WebClient builder to convert all snake_cases into camelCases. Is that possible?
bpereira
  • 966
  • 2
  • 11
  • 29
6
votes
1 answer

Is there any replacement for deprecated property SerializationFeature.WRITE_NULL_MAP_VALUES in Jackson Databind?

We are using ObjectMapper to ignore serialisation of null maps in our project configure(SerializationFeature.WRITE_NULL_MAP_VALUES, false) But after Jackson-Databind 2.9, the property is depreciated and we are looking for an alternate option. Can…
Abhinav Jain
  • 110
  • 1
  • 5
6
votes
1 answer

Unstable behavior with Jackson Json and @JsonAnySetter

I am working on a Java web project using Jackson for Json serialization and deserializtion. I am using Jetty as a web server I am trying to deserialize a generated class at build time: /** *Generated class at compile time **/ …
Ismail
  • 2,322
  • 1
  • 12
  • 26
6
votes
1 answer

Error starting Spring Boot 2.2.1 in WildFly 15 - Jackson StreamFactory Verify Error

I am new to Spring Boot. I am trying to deploy a Spring Boot 2.2.1 project on WildFly 15 as a war. I can build and run a unit test in Maven, but when I deploy to WildFly, I get the following error: WFLYCTL0186: Services which failed to start:…
RodL
  • 131
  • 1
  • 7
6
votes
2 answers

Jackson read-only property in method

I need to exposes a property in my json that will be processed in the getter method. The class: public class Configuracao{ private String departamento; public String getDepartamento(){/**getter code**/} public void setDepartamento(String…
josev.junior
  • 409
  • 2
  • 5
  • 13
6
votes
1 answer

Using Gson instead of Jackson in Spring Webflux

We have many Spring MVC projects already, which all use gson instead of jackson for response body encode. Our bean classes are all written based on gson annotation. Now I am setting up a Spring Webflux restful server. It would save a lot of work if…
Lyux
  • 431
  • 6
  • 12
6
votes
4 answers

Jackson ObjectMapper returns null when Object variable is set to Private

I am given this escaped JSON "{\"UniqueId\":[],\"CustomerOffers\":{},\"Success\":false,\"ErrorMessages\":[\"Test Message\"],\"ErrorType\":\"GeneralError\"}" and I need to convert it to Java object using Jackson. //…
keylogger
  • 822
  • 3
  • 19
  • 39
6
votes
2 answers

How to prevent Jackson to set kotlin.Boolean parameter to false when deserializing

How can I instruct Jackson to not automatically deserialize a kotlin.Boolean parameter to false if the serialized source (e.g. json object) does not contain the field? See the current example: import…
Terje Andersen
  • 429
  • 2
  • 17
6
votes
2 answers

Choosing datatype for field in JSON response

I am working on a Java project which parses a JSON response received from an external API using the Jackson library. One of the fields in the response sometimes comes as a single object and in certain cases, it comes as an array of objects. So I'm…
rakesh
  • 135
  • 3
  • 15
6
votes
2 answers

How can I deserialize a JSON to a Java class which has known mandatory fields, but can have several unknown fields?

I have an input JSON which has fields what I sure inside. But, I need a flexibility to add several extra fields. I don't know the name of the extra fields, but I have to handle it. I was thinking adding a MaP field which contains all of extra…
LordSerius
  • 135
  • 1
  • 7