gmariotti

    gmariotti

    2 years ago
    Hi folks, apologies in advances for the not “kotlin specific” question. Does anyone knows if it is possible to set the mapper to write nested json as a string? For example, a map like
    mapOf("key" to mapOf("innerKey" to "value"))
    serialized as
    { "key": "{\"innerKey\": \"value\"}" }
    instead of
    {"key": {"innerKey": "value"}}
    a

    araqnid

    2 years ago
    I don’t think there’s a simple way to configure something like that, especially if your data model is just Maps. In a class-based model, you could annotate
    @JsonSerialize
    at a specific point and write a serializer/converter to marshal the value as a JSON string there.
    gmariotti

    gmariotti

    2 years ago
    Thanks 🙏. I imagined that was the case, but still worth a try asking