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
7
votes
3 answers

Jackson ignoring XmlElement name/case when marshalling JSON

I am trying to go from XSD->POJO->JSON for use with UPS tracking API which is case sensitive. I'm using Jackson 2.6.7 In the generated JSON. I am seeing camel case names when I should see below: "TrackRequest": { "InquiryNumber":…
Half_Duplex
  • 5,102
  • 5
  • 42
  • 58
7
votes
1 answer

Make the Jackson fail on duplicate property in a JSON

I use Jackson to deserialize a JSON to an immutable custom Java object. Here is the class: final class DataPoint { private final int count; private final int lower; private final int median; private final int upper; @JsonCreator …
danissimo
  • 327
  • 3
  • 10
7
votes
6 answers

jackson.databind no such method errors

I'm using auth0-java client library to interact with auth0 v2 service, my codes compile and works fine at my development environment but when I deploy that build in another test environment it throws the following exception: …
Aminul
  • 1,738
  • 2
  • 24
  • 42
7
votes
3 answers

Jackson - Deserialize Array without property name

I have the following JSON response from shipcloud.io: [ { "name": "dhl", "display_name": "Deutsche Post DHL", "services": [ "standard", "returns", "one_day", "one_day_early" ], "package_types": [ …
7
votes
0 answers

Jackson + Autovalue Builder bean validation

I have a the following Event DTO class: @AutoValue @JsonDeserialize(builder = AutoValue_Event.Builder.class) @JsonIgnoreProperties(ignoreUnknown = true) public abstract class Event { public static Event.Builder builder() { return new…
louis amoros
  • 2,418
  • 3
  • 19
  • 40
7
votes
2 answers

Deserialize MongoDB date fields to Java POJO Using Jackson

Using Spring Boot 1.4.4.RELEASE, have saved a RequestBody to MongoDB as below: { "startTime" : NumberLong("1483542955570"), "startDate" : ISODate("2017-01-04T15:15:55.570Z"), "endTime" : NumberLong("1483542955570"), "endDate" :…
mukulSharma
  • 113
  • 2
  • 6
7
votes
2 answers

Configure Wildfly 10 to use Jackson (as JSON provider)

I have an application that has webservices built with Jersey and Jackson as JSON provider, all this in a Tomcat application server. I need to make this application working on Wildfly 10 and everything is working fine, beside the webservice response…
Alin
  • 111
  • 1
  • 10
7
votes
2 answers

Android - Jackson JSON parser returns null value in 'release' builds

I'm using the Jackson JSON library within my Android app to parse JSON from a REST API. Everything works fine other than a couple of instances where I'm using ObjectMapper.readValue and ObjectMapper.treeToValue to deserialise the JSON to objects. …
Jonathan Wareham
  • 3,357
  • 7
  • 46
  • 82
7
votes
3 answers

Jackson - Deserialize Interface to enum

I have an interface Event and multiple enums that implement this interface (UserEvent, BusinessEvent, etc). I want to deserialize the following json data: { "event" : "SIGNUP" } To this bean: public class Input { private Event event; …
Ali
  • 261,656
  • 265
  • 575
  • 769
7
votes
2 answers

Spring and Jackson: set json ignore dynamically

I have some JPA models: "Category" and "Article": @Entity @Table(name = "categories") public class Category { private int id; private String caption; private Category parent; private List childrenList; @Id @GeneratedValue(strategy =…
Roman Roman
  • 617
  • 1
  • 9
  • 16
7
votes
2 answers

LOG4J2: how to configure JSON layout in properties file

Does anyone know, how to write a log4j2 properties file, which outputs the logs to the console as JSON ? i saw this link, https://logging.apache.org/log4j/2.x/manual/layouts.html#JSONLayout, but it is not clear for me, how do the configuration in a…
EranM
  • 303
  • 1
  • 3
  • 14
7
votes
1 answer

Jackson JSON object mapper deserializes to LinkedHashMap instead of HashMap

I have a POJO that has an inner map. I want this to deserialize into a HashMap from my JSON, but Jackson deserializes the inner map from the JSON into a LinkedHashMap. I can force it to use HashMap by changing the type of the Map from "Map" to…
Seephor
  • 1,692
  • 3
  • 28
  • 50
7
votes
0 answers

Nested polymorphic deserialization with Jackson

I have a use case very similar to Jackson deserializing nested polymorphic type , except that I want to have two nested abstract types deserialized based on JsonTypeInfo.As.PROPERTY with different property names. Supertype: @JsonTypeInfo( use =…
fghkngfdx
  • 135
  • 4
7
votes
3 answers

Custom ExceptionMapper for Jersey not working for invalid JSON input

I have the following resource that consumes a JSON being mapped to a POJO. @Path("example") public class ExampleResource { @POST @Consumes(MediaType.APPLICATION_JSON) public Response addThesis(MyObject myObject) { return…
vigilanum
  • 133
  • 1
  • 5
7
votes
3 answers

Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.JavaType not found

I am using jackson libs in my application and when I build the code (using ant), the build is successful. And I have tried mock testing by using those methods in unit testing and its working fine. But when starting karaf, it gives me this…
Siddharth
  • 884
  • 3
  • 11
  • 27