Thread
#serialization
    j

    Jonathan Olsson

    1 year ago
    Hi! I was wondering if there is any community initiative for encoding/decoding commonly used jdk classes such as BigDecimal and Date with kotlinx.serialization? Browsing the internet it seems as if this is not the case but that rather people are writing their own serializers. Is this by design or further down the priority list? (Jackson by comparison has jackson-module-kotlinto support kotlin classes). Thanks!
    Dominaezzz

    Dominaezzz

    1 year ago
    There's a PR somewhere for this. Someone made a comment about whack-a-mole.
    j

    Jonathan Olsson

    1 year ago
    Hmm. Yeah. I guess it’d be a pretty ungrateful, never-ending stream of incoming requests. 😏 I realize the comparison with Jackson is not really apt given the design philosophy I guess. Still, a focused, curated selection of classes would be pretty useful. I’ll try to find the pull req. 🙏🏼
    p

    Paul Griffith

    1 year ago
    I think it's also generally against the idiom of Kotlin modules, which tend to be 'lighter', than Java modules, which tend towards all-inclusive
    Dominaezzz

    Dominaezzz

    1 year ago
    Perhaps the community should build one. I'd do it but I can't be arsed to deal with mavenCentral rn.
    p

    Paul Griffith

    1 year ago
    I think it'd be nice to have, but I don't know that I'd personally use it - I've needed custom serializers for some java.time classes, but I think there's enough gotchas (alluded to in that PR) that I don't actually know if you could satisfy all requirements for arbitrary java.time (de)serialization
    j

    Jonathan Olsson

    1 year ago
    I don't personally have enough experience (with java nor kotlin) to do a valid estimation on the impact all those gotchas would have, but given both Jackson and Gson (I guess the less kitchen-sinky of the two) has built in type adaptors for a few additional classes, it's probably at least feasable. Whether it fits with the overaching strategy of the project is ofc another matter. Perhaps, the core is better left handling basic primitives and separate modules deal with additional types.
    bartvh

    bartvh

    1 year ago
    A commonly used public lib woluld be nice. Doesn't have to be part of the core of the serialization lib. I have a few serializers for "standard" types here. Not really in a plug-and-play format, but for what it's worth, feel free to use/copy/rip off.https://github.com/bartvanheukelom/jbali/tree/master/src/jvmMain/java/org/jbali/kotser/std