Dot in a variable name for JSON serialization

Hello, I have a valid JSON like:

  "add.values": {
    "page": 1,
    "page_size": 2

I’d like to make it a string with Json.encodeToString (Kotlin Serialization) from a data class. But I can’t name the variable like ``add.values``. What is the best way to do that?

You need to annotate your property with: @SerialName("add.values").

1 Like

Thanks for your support. Didn’t think it works both ways.