ristianNHenriksen.KotlinJson.1.0.source-code.JsonParser.kt Maven / Gradle / Ivy
import com.fasterxml.jackson.core.type.TypeReference
import com.fasterxml.jackson.databind.ObjectMapper
/**
* Created by Christian on 17/09/2016.
*/
object JsonParser {
private val mapper = ObjectMapper()
/**
* Parse a Json string into a Json object.
*
* @param string A valid json string.
* @return The Json object parsed from the string.
*/
fun parse(string: String): Json {
val value: Map = mapper.readValue(string, JsonMapType())
return Json(value)
}
class JsonMapType: TypeReference
© 2015 - 2025 Weber Informatics LLC | Privacy Policy