@Serializable
data class DataPoint (
val name: String,
val value: Double
)
bjonnh
05/10/2018, 12:08 AM
When I try that:
Copy code
val list = mutableListOf<DataPoint>()
list.add(DataPoint("A", 1.34))
val foo = JSON.stringify(DataPoint::class.serializer().list, list)
bjonnh
05/10/2018, 12:09 AM
I get a
Copy code
Can't locate default serializer for class class gui.DataPoint
s
Shawn
05/10/2018, 12:09 AM
you ought to surround with ` ``` ` for ease of reading
👍 1
b
bjonnh
05/10/2018, 12:23 AM
I also tried:
Copy code
@Serializable
data class DataPoint (
val name: String,
val value: String
)
@Serializable
data class DataPoints (
val elements: MutableList<DataPoint>
)
with
Copy code
val liste = DataPoints(elements = mutableListOf())
liste.elements.add(DataPoint("A", "1.34"))
val foo = JSON.stringify( liste)
bjonnh
05/10/2018, 12:34 AM
plugin("kotlinx-serialization") was missing…
s
Shawn
05/10/2018, 12:34 AM
ahhh
b
bjonnh
05/10/2018, 12:59 AM
But it is for use in webview and I can't see how to do that without writing a full string parsing library…