Questions tagged [jackson2]

Use this tag only for questions specifically related to version 2 of the Jackson library

Jackson version 2 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.

464 questions
1
vote
1 answer

Jackson serialize nested attribute with same name

Currently, I have a JSON response of the following type. { "user":{ "user":{ "name":"Demo", "age":25, "eail":"demo@abc.com" }, "address":{ "country":"NZ" } } } I want to map my…
1
vote
1 answer

Jackson @JsonTypeInfo is making the field unable to read during the deserialization of JSON

I am using Jackson to deserialize a JSON. The Jackson has to handle 2 things: Identify if the provided JSON is a document and if so deserialize the elements in CustomerList one by one. Identify if the provided JSON is a single Customer and if so…
BATMAN_2008
  • 2,788
  • 3
  • 31
  • 98
1
vote
0 answers

Jackson2 deserialise of MariaDB `JSON_ARRAY` column

I have a MariaDB database with a column of type JSON which contains a Json Array: `loadArray01` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL CHECK (json_valid(`loadArray01`)) In Maria DB a JSON column is a longtext one with a…
Stefano Bossi
  • 1,138
  • 1
  • 9
  • 19
1
vote
0 answers

multi jackson date format config in springboot application

In my springboot applicaiton, serialization date format pattern = 'yyyy-MM-dd HH:mm:ss', and I want to deserialization date format pattern = 'yyyy-MM-dd'. In the application.yml: spring: jackson: timezone: "GMT+8" date-format: "yyyy-MM-dd…
Stephen.lin
  • 166
  • 1
  • 12
1
vote
2 answers

Jackson Custom Serializer shows the same context for 2 different field during the Json Serialization

I am trying to create a JSON based on my Object class POJO. For some fields, I would like to use the CustomSerializer as I would like to create the fields according to my requirement. Hence, I have created the CustomSerializer.class. The…
BATMAN_2008
  • 2,788
  • 3
  • 31
  • 98
1
vote
2 answers

Jackson JSON Serialization without field name

I have a JAVA POJO which has many fields. One of the fields is Map for which I am using the Custom JsonSerializer as it can have many type of Objects. All I want to know is how can I avoid the Serialization of the fieldname only for…
BATMAN_2008
  • 2,788
  • 3
  • 31
  • 98
1
vote
2 answers

What is the gradle dependency of JacksonFactory?

I am need to use JacksonFactory for my program but the dependency not working that I found implementation group: 'com.google.api-client', name: 'google-api-client-jackson2', version: '1.31.3' it work only in version 1.20.0 but when I use this…
1
vote
1 answer

Parse JSON array from a response body using Resteasy and Jackson annotations

I'm using Resteasy with Quarkus, and Jackson annotations (io.quarkus.quarkus-resteasy, io.quarkus.quarkus-resteasy-jackson, version 1.13.2.Final). I need to parse this kind of response from an API I call : [ { "name": "John Smith", "age":…
Eria
  • 2,653
  • 6
  • 29
  • 56
1
vote
2 answers

Jackson @JsonAnySetter ignores values of duplicate key when used with Jackson ObjectMapper treeToValue method

I am using the Jackson library to deserialize JSON. In the JSON I have a few custom fields whose values can be anything, so I am trying to use the @JsonAnySetter and @JsonAnyGetter to obtain the values. The fields and values within the JSON can be…
BATMAN_2008
  • 2,788
  • 3
  • 31
  • 98
1
vote
2 answers

Is there a way to make use of Jackson ObjectMapper to read the object from JSON one by one

I wanted to know if it's possible to make use of ObjectMapper from Jackson to read events one-by-one. I have a large JSON file that consists of many events that I need to convert to XML. I do not want to load the complete JSON events into my memory…
BATMAN_2008
  • 2,788
  • 3
  • 31
  • 98
1
vote
0 answers

How do get relativePaths in JsonNode using java and Jackson

I am working over JsonNode and trying to get relativePath and add as attribute . public static void iterateOver(JsonNode masterJSON) { Iterator> nodes = masterJSON.fields(); while (nodes.hasNext()) { …
1
vote
0 answers

dealing with exceptions in @JsonFormat pattern

I am using the @JsonFormat annotation from the fasterxml.jackson library: @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") private Date endDate; @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd…
1
vote
0 answers

What is the difference between UndertowJaxrsServer.deploy and UndertowJaxrsServer.deployOldStyle?

I'm trying to produce a bootable jar with Undertow + Resteasy + Jackson2 with those dependencies in my pom.xml: org.jboss.resteasy resteasy-undertow
1
vote
1 answer

Using default unwrapping serializer of a Jackson ObjectMapper

I have a custom JsonSerializer and in the serialize() method I want to use the default serializer behavior of a registered ObjectMapper: class Serializer extends JsonSerializer { private ObjectMapper myObjectMapper; …
Kian
  • 211
  • 1
  • 3
  • 17
1
vote
1 answer

Using @JsonUnwrapped and having a custom Serializer (StdSerializer)

I need to write a custom Serializer for one of my entities "Payment" and I have to implement it by extending StdSerializer: class Payment { } class PaymentSerializer extends StdSerializer { public PaymentSerializer() { …
Kian
  • 211
  • 1
  • 3
  • 17