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 - @JsonCreator return generics

I want to integrate vavr validation library in my command dto's in a way that when command dto is deserialized from request, return type of the static factory will be Try but jackson is throwing following error : Type definition error: [simple…
user3018350
1
vote
1 answer

Java JSON - Override @JsonIgnore for tests

I have project in Spring Boot. I have User model, what have Profile model in relation OneToOne: User: (Simplified) @Entity @Table(name = "users") public class User extends AbstractEntity { @Id @GeneratedValue private Integer id; …
Baterka
  • 3,075
  • 5
  • 31
  • 60
1
vote
1 answer

UnrecognizedPropertyException when using Jackson, @JsonIdentityInfo and @JsonDeserialize with a lombok Builder

I am trying to Serialize and deserialize a very large object graph. in order to reduce the size of the generated JSON, I thought I would use Jackson's @JsonIdentityInfo annotation, which seems to work well for this particular usecase. However when I…
Mikkel Løkke
  • 3,710
  • 23
  • 37
1
vote
2 answers

Jackson JSON Date Deserialization to Timestamp

I am trying to map a JSON to POJO using Jackson2 for my REST method. The DueDate attribute in my POJO is of type java.util.date. I read that Jackson will deserialize JSON to timestamp by default. I want this behavior only. However, Jackson is…
BB8
  • 41
  • 2
  • 10
1
vote
1 answer

RESTEASY003145: Unable to find a MessageBodyReader of content-type text/xml;charset=UTF-8

I'm a newbie in a REST services, but all solutions I found was due to lack of necessary providers. Dependencies: compile group: 'org.jboss.resteasy', name: 'resteasy-client', version: '3.6.1.Final' compile group: 'org.jboss.resteasy', name:…
abi
  • 99
  • 8
1
vote
0 answers

REST streaming with configure amount of processing object - unloading memory

I implement rest streaming and for now all works fine, but I see one problem with my implementation, when sending big amount of heavy file. For example, when I send 10 files by 100 MB in memory I have 1GB. So my question is how to implement this in…
newOne
  • 679
  • 2
  • 9
  • 27
1
vote
0 answers

Fasterxml jackson polymorphism error

I'm using wildfly with resteasy + jackson and I've created a super abstract class named Participation, a subclass InnovationParticipation and a simple rest service. Here is the code: //Super abstract class @JsonTypeInfo(use=Id.NAME,…
Giamma
  • 808
  • 2
  • 10
  • 21
1
vote
1 answer

Issue with JSON parsing using RestTemplate

I am trying to parse the JSON response from a service using RestTemplate.exchange() method. But it is failing with parse error. Java code RestTemplate restTemplate = new RestTemplate(); HttpHeaders headers = new HttpHeaders(); …
MKP010
  • 61
  • 1
  • 4
  • 11
1
vote
0 answers

Jackson XmlMapper: deserialize true/false as boolean values

I would like to convert xml structure into json by using Jackson library input xml: true output json should…
rome
  • 476
  • 1
  • 9
  • 19
1
vote
1 answer

Convert object into JSON file in Jackson without object mapper

I'm using Google Cloud Endpoints in Android. And these libs in gradle implementation 'com.google.api-client:google-api-client-android:1.23.0' Which include Jackson2. I know how to write and read JSON from files using jackson. But problem is that…
1
vote
0 answers

POJO for JSON with mixed types in same array

I'm using Spring Boot with Jackson. I have an unusual JSON set coming in from Elasticsearch (spring-data-elasticsearch) which I need to read into a POJO. { "thread_name":"main", "sort":[ 1522270372773, …
JvmSd121
  • 351
  • 3
  • 17
1
vote
2 answers

Date stored in different format

I have this date "2018-05-30T16:19:58.016Z" coming from my Angular app. In Spring, the field date is as follows : @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") private Date date; The date is well stored, but with this format YYYY-MM-dd. Is…
androniennn
  • 3,117
  • 11
  • 50
  • 107
1
vote
1 answer

Spring MVC - receiving XML Objects and deserialzing into Collection

I'm attempting to deserialize an XML payload (body of a SOAP message, but nothing else), with a specific hierarchy of tags / objects. When attempting to aggregate unwrapped objects into a List, a MismatchedInputException is thrown. Example…
Leo
  • 283
  • 4
  • 10
1
vote
1 answer

Spring 5.0.4 & Jackson2 throws excepiton on startup

I am trying to make simple REST service but faced with 2 problems. 1. Any method of REST controller returns 406 http error; @GetMapping(value = "/getUser/{id}", headers = "Accept=application/json", produces =…
Jesper
  • 49
  • 9
1
vote
0 answers

Jackson - objectMapper.enableDefaultTyping puts package name in JSON

I've complex (nested and custom classes) object to be serialized and deserialized. I used objectMapper.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY); Serialized Json looks like…
unknown_boundaries
  • 1,482
  • 3
  • 25
  • 47