https://kotlinlang.org logo
#server
Title
# server
m

Md Sadique Inam

03/15/2024, 1:34 AM
How to serialize form-data using kotlinx-serialization
👀 2
c

Cies

03/19/2024, 12:38 PM
I wrote an internal library to *de*serialize the
x-www-form-urlencoded
body from
POST
requests sent by browser on form submit into a
FormDto
data class object. It uses Jackson (JSON lib for the JVM) as it has really good type coercion features (in the
x-www-form-urlencoded
body everything is a string, in the
FormDto
data class object we have specific types: Long, Int, Enum, Boolean, String, some sub-FormDto data class and collections of the aforementioned). Works like a charm! (more lines of test than lines of actual lib code)
2 Views