Thread
#serialization
    a

    Ayfri

    5 months ago
    Hi, I'm trying to use a JsonTransformingSerializer to transform an array of strings into one string if there is only one and keep as array else I'm using this
    override fun transformSerialize(element: JsonElement): JsonElement {
        require(element is JsonArray) // this serializer is used only with lists
        return element.singleOrNull() ?: element
    }
    Which is the exact code from the documentation but I'm getting nothing when there's one string and an array if multiple, what I'm doing wrong 🤔
    Nevermind, I was removing the property on a failed filter on the json output