1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-11-15 03:20:18 +00:00

fix warnings

This commit is contained in:
2019-02-21 14:21:33 +08:00
parent 2974a33e51
commit 313068543f
10 changed files with 55 additions and 53 deletions

View File

@@ -4,13 +4,15 @@ import kotlinx.serialization.*
import kotlinx.serialization.json.*
@ImplicitReflectionSerializer
inline fun <reified T: Any> T.toJsonWithoutNulls(): JsonObject = toJson(serializerByValue(this)).withoutNulls()
inline fun <reified T: Any> T.toJsonWithoutNulls(): JsonObject = Json.nonstrict.toJson(
this
).jsonObject.withoutNulls()
inline fun <reified T: Any> T.toJsonWithoutNulls(serializer: KSerializer<T>): JsonObject = toJson(serializer).withoutNulls()
inline fun <reified T: Any> T.toJson(serializer: KSerializer<T>): JsonObject = JsonTreeMapper().writeTree(
this,
serializer
inline fun <reified T: Any> T.toJson(serializer: KSerializer<T>): JsonObject = Json.nonstrict.toJson(
serializer,
this
).jsonObject
fun JsonArray.withoutNulls(): JsonArray {