Why doesn't the MutableList get encoded to JSON? I...
# serialization
a
Why doesn't the MutableList get encoded to JSON? It only prints
{}
Copy code
import kotlinx.serialization.*
import kotlinx.serialization.json.*

fun main() {
    val a = A()
    println(a)
    println(Json.encodeToString(a))
}

@Serializable
data class A(
    val list: MutableList<String> = mutableListOf("a", "b", "c"),
)
Copy code
A(list=[a, b, c])
{}
https://pl.kotl.in/iubN0SLUB
1