Questions tagged [jackson-annotations]
15 questions
2
votes
1 answer
Jackson-databind deserializes JSON with missing property as "null" instead of default value
When deserializing a JSON string, missing properties are being set as "null" when they shouldn't be. Below is a POJO class:
@Builder
@Getter
@Setter
@JsonInclude(JsonInclude.Include.NON_NULL)
@NoArgsConstructor
…

Biiiiiird
- 384
- 1
- 3
- 17
1
vote
1 answer
Could not read JSON: Conflicting setter definitions for property
When I call the API for the first time, I receive a JSON response without any error.
When I call the API for the second time, I receive:
Could not read JSON: Conflicting setter definitions for property "zipCode":…

Taha LAGHZALI
- 464
- 2
- 14
1
vote
2 answers
Jackson Deserialization: @JsonAlias doesn't work
I try to fill up an Java Object with a Json String, which can come with different kinds of variable names for the same field. That's why I try to use @JsonAlias. Unfortunately, I couldn't make it work yet for unknown reasons..
Here is my…

franc.rovetto
- 21
- 6
1
vote
2 answers
How to map unwrapped JSON field to wrapped object with Jackson?
I have a JSON of structure
{
"name": "...",
"age": "..."
}
I have to map this JSON to following class object
Class Response {
Person person;
}
Class Person {
String name;
String age;
}
Is there any Jackson annotation that helps me do this…

Ajay Sabarish
- 107
- 9
1
vote
2 answers
Different @JsonProperty config for READ and WRITE on same field?
I have a class (which cannot be modified) like
public class Standing {
private Integer positionNumber;
private String positionText;
private BigDecimal points;
..
}
When deserializing I get data like:
{
"position": "1",
…

Marcel Overdijk
- 11,041
- 17
- 71
- 110
0
votes
1 answer
Jackson annotation to convert java.uti.Date to java.time.Instant
My rest service is calling another Rest API using sprint rest template. Java class corresponding to Request body has one field is of type Date (java.util.date) as application source is 1.6 java. Now the corresponding request class of the receiver…

akr
- 123
- 1
- 1
- 9
0
votes
1 answer
keycloak : Unrecognized field "access_token"
I've a problem with the keycloak admin client.
When I try to do :
// Création d'un client Keycloak
Keycloak keycloak = KeycloakBuilder.builder()
.serverUrl(keycloakUrlAuth)
.realm(keycloakRealm)
…

Greg
- 11
- 2
0
votes
0 answers
Android parse JSON using JacksonAnnotation
I'm trying to parse a JSON without results.
I've a response like following:
{
"0": {
"id": "4",
"nome": "Zero Gravity",
"id_stop": "0"
},
"1": {
"id": "540",
"nome": "First Name",
"id_stop": "111"
}
}
The problem is…

DoctorWho
- 1,044
- 11
- 34
0
votes
0 answers
I am trying to exclude null fields from json response
I tried possible ways like
@JsonInclude(value = Include.nonnull, content = Include.nonempty)
@jsonserialize annotation as well but nothing seems to suppressing null fields from response i am using jackson core version 2.9.9 not sure what I am…

Kaviraj
- 1
0
votes
0 answers
Java Jackson deserialize to object from multiple json formats
Let's assume there are those 2 different json structures - both contain the same values, but the key hierarchy differs - one is flat, the other is nested:
Flat:
{
"documentId": "7ef1229c-301a-40d9-8c0c-faf5da54785d",
"first_name":…

Quirynn
- 26
- 2
0
votes
0 answers
Error - Cannot define Creator property "posicao" as `@JsonUnwrapped`: combination not yet supported
I'm having a problem serializing/deserializing a json , the error is as follows:
Failed to evaluate Jackson deserialization for type [[simple type,
class com.challenge.model.Sense]]:
com.fasterxml.jackson.databind.exc.InvalidDefinitionException:…
0
votes
1 answer
Inner object deserialization with Jackson
I have a json
{
"params": [
{
"key": "path",
"options": {
"string": {
"prefix": "test_pref"
}
},
"default": {
"url": ""
}
}
]}
I have the following…

grav
- 1
- 1
0
votes
0 answers
how to generate annotation @JsonIgnoreProperties with swagger API 2.0 using json
My POJOs are auto generated from swagger 2.0 using json files. I want certain POJOs to have annotation @JsonIgnoreProperties(ignoreUnknown = true) as class level. The annotation is from com.fasterxml.jackson.annotation.JsonIgnoreProperties. So how…

MiGo
- 551
- 2
- 7
- 17
0
votes
3 answers
java.lang.NoSuchFieldError: com/fasterxml/jackson/annotation/JsonInclude$Include.USE_DEFAULTS
I am using spring 5.3.7
and when I start my application, it returns the error below:
Instantiation of bean failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to…
0
votes
0 answers
Use Variables in JSON and deserialize in POJO based on section
I have defined an example JSON below-
{ "common" : {
"data" : [ {
"ref" : "data1"
"x" : "${variable1}",
}, {
"ref" : "data2"
"y" : "${variable2}"
}
]
},
"section1" : {
"variables" : {
…

tg_anon
- 231
- 1
- 3
- 6