JsonUtils

object JsonUtils

Functions

Link copied to clipboard
inline fun <T : Any> jsonAs(json: String): Result<T>

Parses json as an instance of T.

fun <T : Any> jsonAs(json: String, dataclass: KClass<T>): Result<T>

Parses json as an instance of dataclass.

Link copied to clipboard
fun <T> toJson(obj: T, pretty: Boolean = false): String

Writes the content of obj into a JSON string.