FasterXML / FasterXML/jackson-databind

Exception while deserializing with `@JsonRootName` when multiple root properties

Aperta
#2,253 15 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Java
Stelle
3.7k
Fork
1.5k
Merge medio
3g 6h
PR unite (30g)
28

Descrizione

Desirialization does not work when there are multiple nodes available at same level as value provided in the JsonRootName

Note:
Wrapper is configured with following:
```
objectMapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
```

Class:
```
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
@JsonIgnoreProperties(ignoreUnknown = true)

@JsonRootName(value = "response")
public class UserProfile {
String name;
String link;
}
```

Input JSON (which works):
```
{
"response": {
"name": "User one:",
"link": "Some Link"
}
}

```

Input JSON (which does not work)
```
{
"response": {
"name": "User one:",
"link": "Some Link"
},
"apiVersion" : 1.0
}

```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.