Andrew Gazelka
07/02/2019, 9:43 PMval people = setOf(personA, personC)
)
json {
"test1" to array(personA, personC) //works
"test2" to array(*people) // does not work
}
interface KlaxonJson {
fun array(vararg args: Any?) : JsonArray<Any?> = JsonArray(args.map { convert(it) })
// ...
karelpeeters
07/02/2019, 9:52 PM*
only works on arrays, not sets.Toddobryan
07/02/2019, 10:13 PM.toTypedArray()
first.karelpeeters
07/02/2019, 10:14 PMToddobryan
07/02/2019, 10:16 PM.toTypedArray()
before you use the spread operator, but you'd end up with (*people.toTypedArray())
and I think the precedence works out so that the set is converted to an array before the spread operator is applied. (Sorry for using "first" in a horribly ambiguous way.)karelpeeters
07/02/2019, 10:17 PM*
and toTypedArray
, just the latter will do 😒imple_smile:Hullaballoonatic
07/04/2019, 8:07 PMkarelpeeters
07/05/2019, 8:08 AMHullaballoonatic
07/05/2019, 11:14 PMoperator fun spread
is 3 years old. probably not gonna happen at this point