Using kotlinx-serialization-runtime:0.10.0 the following code produces an empty array:
jsonArray {
+2
+4
+6
+8
}
Being more verbose works as expected:
jsonArray {
+JsonPrimitive(2)
+JsonPrimitive(4)
+JsonPrimitive(6)
+JsonPrimitive(8)
}
It seems that https://github.com/Kotlin/kotlinx.serialization/blob/master/runtime/common/src/test/kotlin/kotlinx/serialization/json/serializers/JsonArraySerializerTest.kt lacks tests for the the unaryPlus overloads defined in JsonArrayBuilder, maybe.