fix Any.prettyJson() bug

This commit is contained in:
tursom 2020-04-15 20:28:41 +08:00
parent 79b947e30f
commit f62f7fc636

View File

@ -24,7 +24,7 @@ val prettyGson = GsonBuilder()
.create()
fun Any.toJson(): String = gson.toJson(this)
fun Any.toPrettyJson(): String = gson.toJson(this)
fun Any.toPrettyJson(): String = prettyGson.toJson(this)
inline fun <reified T : Any> String.fromJson(): T = gson.fromJson(this, T::class.java)
inline fun <reified T : Any> Gson.fromJson(json: String) = this.fromJson(json, T::class.java)!!