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
Copy code
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 🤔
Ayfri
04/19/2022, 3:30 AM
Nevermind, I was removing the property on a failed filter on the json output