1,182 questions
0 votes
0 answers
59 views
Serializing generic Object properties to Avro union types
I am trying to map a generic Java object client RequestDto to a complex Avro record that includes unions. The Situation: I have been given an Avro schema, which means I can't/shouldn't make any ...
0 votes
1 answer
81 views
Is it possible create an ObjectMapper configured such that it AES encrypts all fields except fields annotated with a certain annotation?
Let's say you have an annotation configured on a per field basis: import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import ...
0 votes
0 answers
52 views
Is it possible have Jackson's ObjectMapper honor the configured serialization features when serializing a JsonNode?
ObjectMapper mapper = new ObjectMapper() .configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true) .configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true); Map<String,...
-1 votes
1 answer
168 views
Getting JSON from URL (from API that need an authentication token) SPRING
I am trying to build database - and i want to get data that i need from API which have an authentication token - im using Java, Spring, MySql DB I've created simple example of what i want to achieve - ...
0 votes
2 answers
168 views
How to override @JsonProperty(value = "id", access = JsonProperty.Access.READ_ONLY) on object mapper
I've a model class which I can't change its source, it is annotated with public class Announce { @JsonProperty(value = "id", access = JsonProperty.Access.READ_ONLY) @Id @...
0 votes
1 answer
165 views
How to configure PersistentEntityJackson2Module in Spring Boot 3.4.0?
We are migrating the Spring Boot application (mixture of Spring Data Rest with plain vanilla mvc) from version 2.5.12 to 3.4.0. The application heavily depends on the ObjectMapper configured with ...
4 votes
1 answer
4k views
java.lang.NoSuchMethodError: 'void com.fasterxml.jackson.core.util.BufferRecycler.releaseToPool()'
I've upgraded Jackson from 2.16.1 to 2.18.2 in my build.gradle: plugins { id 'java' id 'jacoco' id 'com.github.johnrengelman.shadow' version '8.1.1' id "org.sonarqube" ...
0 votes
0 answers
107 views
ObjectMapper truncates strings in Map
I'm trying to parse a JSON string into a Map using ObjectMapper. To achieve this, I used this simple code below. ObjectMapper objectMapper = new ObjectMapper(); Map value = objectMapper.readValue((...
2 votes
1 answer
72 views
Derive TypeReference for wrapper type from nested type
Jackson's TypeReference allows reifying the generic type parameters of a type via subclassing. Example: final var typeRef = new TypeReference<List<MyType<MyArg>>>() {}; final List<...
0 votes
1 answer
105 views
Jackson: Deserialize all kind of non-existing Lists into empty Lists [duplicate]
Given the following SampleTestClass where I try to parse JSON to Java: class EmptyListDeserializerTest { final ObjectMapper objectMapper = new ObjectMapper(); { objectMapper.configOverride(List....
0 votes
2 answers
11k views
JsonParseException while parsing double quotes in Java string using object mapper
I have an issue while trying to parse a string value using object mapper. Below is my code, @Data @NoArgsConstructor @AllArgsConstructor public class Payload { private String id; private ...
-1 votes
1 answer
73 views
Jackson Custom Object Mapper [closed]
I'm looking for some help. I have a requirement to convert the input json to a java object. Input JSON is something like this { "code" : "some code", "type" : "...
0 votes
2 answers
253 views
Spring controller won't deserialize instant
I'm having trouble integrating Spring with Jackson. I have a POJO which has some Instant fields with a custom date format: public class C{ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = &...
0 votes
1 answer
623 views
ObjectMapper in RestClient not picking up configuration properties
In my Spring Boot service, I'm using RestClient to perform REST calls. I want to ignore null values in request bodies so I set up spring: jackson: default-property-inclusion: "non_null"...
1 vote
1 answer
91 views
Jackson Object Mapper readTree with boolean values
{ "data":{ "id":"550e8400-e29b-41d4-a716-446655440000", "timestamp":"2023-05-01T16:34:16.993007076Z", "isProcessed":...