cedric
03/07/2018, 9:10 PMcedric
04/02/2018, 4:47 PMAngius
04/03/2018, 1:27 AMTobias Preuss
04/11/2018, 9:37 AMnew Klaxon().parse<>
(the .parse()
function) is not available as stated in the docs. How am I supposed to read a JSON string?cedric
04/11/2018, 4:44 PMTobias Preuss
04/12/2018, 11:58 AMcedric
05/01/2018, 4:57 PMcedric
05/11/2018, 9:28 PMgildor
07/17/2018, 3:22 PMcamdenorrb
08/01/2018, 1:10 AMkarelpeeters
08/02/2018, 9:07 PMdata class Foo(val a: JsonObject)
fun main(args: Array<String>) {
val json = """{ "a": { "hello": "world" } }"""
val result = Klaxon().parse<Foo>(json)
println(result)
}
karelpeeters
08/15/2018, 8:02 AMdamian
09/12/2018, 9:23 AMPending exception java.lang.RuntimeException: Unexpected character at position 1023: 'n' (ASCII: 110)'
cedric
09/18/2018, 3:33 PMjlleitschuh
10/02/2018, 12:45 AMcedric
10/02/2018, 8:16 PMcedric
10/10/2018, 7:12 PMketurn
10/15/2018, 1:00 AMConverter.toJson
implementation works, but it feels like I'm doing something wrong. Should I be creating additional Klaxon()
instances inside toString
and specifying converters for nested fields there?Kylych
10/18/2018, 5:05 AMarve
10/23/2018, 10:34 AMdata class Thing(val controllers: List<String>) {
constructor(controllers: Map<String, Boolean>): this(controllers.keys.toList())
}
val json = """ {
"controllers": {
"a": true,
"b": true,
}
}""".trimIndent()
println(Klaxon().parse<Thing>(json))
This fails with com.beust.klaxon.KlaxonException: Couldn't find a suitable constructor for class Thing to initialize with {controllers=}: java.lang.IllegalArgumentException argument type mismatch
- but the given alternate constructor should be suitable, no?cedric
12/26/2018, 2:39 PMdvlwj
03/12/2019, 9:48 AM{
"records" : [
{
"field": value ,
"field": value
},
{
"field": value,
"field": value
},
// etc until xxx times
}
how i can parse the records
?
I know and already can parse the data inside records
, but i m not sure how to get records
.
I already try to parse it with this code :
class Records(val Records:List<Any>? = null)
but its failed.czuckie
04/16/2019, 8:52 PMAndrew Gazelka
05/10/2019, 1:57 AMcedric
05/21/2019, 5:38 PMSpel98
05/29/2019, 11:24 AMK0NN4
06/18/2019, 11:16 PMHullaballoonatic
06/27/2019, 1:35 AMkotlinx-serialization
? For what reasons should I use one over the other?cedric
09/05/2019, 2:13 PMJosephwlnorman
09/05/2019, 2:14 PM