Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
IT Security Toolsndaal_public_SBOM_Auditor(23.09.2026 um 06:34 Uhr)
IT Security NachrichtenLooking for free Robux? Here’s what’s real, and what’s a scam(22.09.2026 um 11:00 Uhr)
Malware / Trojaner / VirenNew CAIRN Tool Hunts Malware That Uses AI Models to Automate Cyberattacks(23.09.2026 um 07:30 Uhr)
Sicherheitslücken (CVE)IT Security News Hourly Summary 2026-09-23 07h : 4 posts(23.09.2026 um 07:00 Uhr)
IT Security Toolsndaal_public_SBOM_Auditor(23.09.2026 um 06:34 Uhr)
IT Security NachrichtenLooking for free Robux? Here’s what’s real, and what’s a scam(22.09.2026 um 11:00 Uhr)
Malware / Trojaner / VirenNew CAIRN Tool Hunts Malware That Uses AI Models to Automate Cyberattacks(23.09.2026 um 07:30 Uhr)
Sicherheitslücken (CVE)IT Security News Hourly Summary 2026-09-23 07h : 4 posts(23.09.2026 um 07:00 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

How to deal with empty lists that defaults to null in Jackson and Kotlin

How to deal with empty lists that defaults to null in Jackson and Kotlin Most times using Jackson will be straightforward and we won’t have to fiddle, but in the case you need to deserialize a data class that can have empty lists in K…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!




How to deal with empty lists that defaults to null in Jackson and Kotlin



Most times using Jackson will be straightforward and we won’t have to fiddle, but in the case you need to deserialize a data class that can have empty lists in Kotlin you can run into a null assertion error.

Here’s a data class:





@JsonInclude(JsonInclude.Include.NON_NULL)
data class SomeDataClass(
val otherFieldA: String? = null
val someOtherDataClassList: List<SomeOtherDataClass> = arrayListOf()
)






In the previous code we have a potential error if payload received is an empty list in the field someOtherDataClassList



The simplest to this, using Jackson 2.17 (most recent version to the date this article was written) was to declare the Jackson Kotlin Module manually, and instead of using ObjectMapper.registerKotlinModule(), use this:




 object JacksonProvider{

private val kotlinModule = KotlinModule.Builder()
.configure(KotlinFeature.NullIsSameAsDefault,true)
.build()

val mapper: ObjectMapper = ObjectMapper()
.registerModule(kotlinModule)
...(your other configuration options)...
}







And that’s it! now you have a working empty list that does not throws an error while using Jackson and Kotlin.



The needed dependency is:




  implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.17.+")






Thank you for reading!

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten How to deal with empty lists that defaults to null in Jackson and Kotlin

Thematisch verwandte Begriffe: deal, with, empty, lists · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-18163 | IBM Financial Transaction Manager (FTM) for RedHat OpenShift could allow…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick