Commit 696889ba authored by ryoii's avatar ryoii

update json object

parent 04b71514
......@@ -20,7 +20,7 @@ object MiraiJson {
inline fun <reified T : Any> String.jsonParseOrNull(
serializer: DeserializationStrategy<T>? = null
): T? = try {
if(serializer == null) MiraiJson.json.parse(this) else MiraiJson.json.parse(serializer, this)
if(serializer == null) MiraiJson.json.parse(this) else Json.parse(this)
} catch (e: Exception) { null }
......@@ -29,7 +29,7 @@ inline fun <reified T : Any> String.jsonParseOrNull(
inline fun <reified T : Any> T.toJson(
serializer: SerializationStrategy<T>? = null
): String = if (serializer == null) MiraiJson.json.stringify(this)
else Json.stringify(serializer, this)
else MiraiJson.json.stringify(serializer, this)
......@@ -39,4 +39,4 @@ inline fun <reified T : Any> T.toJson(
inline fun <reified T : Any> List<T>.toJson(
serializer: SerializationStrategy<List<T>>? = null
): String = if (serializer == null) MiraiJson.json.stringify(this)
else Json.stringify(serializer, this)
\ No newline at end of file
else MiraiJson.json.stringify(serializer, this)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment