FasterXML / FasterXML/jackson-module-kotlin

Jackson 2.12.3 and later fails to collapse XML list using @JsonAlias

Open
#721 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Kotlin
Stars
1.2k
Forks
187
Avg merge
9h 48m
Merged PRs (30d)
16

Description

As described in [this blog post](https://medium.com/@foxjstephen/how-to-actually-parse-xml-in-java-kotlin-221a9309e6e8) it has been possible to deserialize this:

```


1056.38
Simple


```

... into a collaped list like this:
```
data class LedgerActivityDetail(
@set:JsonProperty("TransactionType")
var loanType: String? = null,

@set:JsonProperty("Amount")
var amount: String? = null
)

@JsonRootName("LedgerActivityObject")
data class LedgerActivity(

@set:JsonProperty("LedgerTransactionDate")
var LedgerTransactionDate: String? = null,

@set:JsonProperty("Amount")
var amount: String? = null,

// HERE IS WHERE THE MAGIC HAPPENS!!!
@set:JsonAlias("LedgerTransactionDetails", "LedgerActivityDetailObject")
var LedgerActivityDetails: List = ArrayList()
)
```
This worked until jackson 2.12.2. In 2.12.3 and onwards (including 2.16.0-rc1) the inner values of LedgerActivityDetail are `null`

Here's a test project: https://github.com/henrik242/jackson-xml-problem/blob/list-wrappers/src/test/kotlin/jackson/xml/ListWrappersTest.kt

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.