Skip to content

Commit

Permalink
added fromJsonString fun
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedsmiai committed Sep 13, 2023
1 parent 0d35684 commit ae50b43
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/kotlin/id/walt/nftkit/rest/NftKitApi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import id.walt.rest.OpenAPIUtils.documentedIgnored
import io.javalin.Javalin
import io.javalin.apibuilder.ApiBuilder.*
import io.javalin.core.util.RouteOverviewPlugin
import io.javalin.plugin.json.JavalinJackson
import io.javalin.plugin.json.JsonMapper
import io.javalin.plugin.openapi.InitialConfigurationCreator
import io.javalin.plugin.openapi.OpenApiOptions
Expand Down Expand Up @@ -104,6 +105,10 @@ object NftKitApi {
override fun toJsonString(obj: Any): String {
return Klaxon().toJsonString(obj)
}
override fun <T : Any?> fromJsonString(json: String, targetClass: Class<T>): T & Any {
return JavalinJackson(mapper).fromJsonString(json, targetClass)!!
}


/*override fun <T : Any?> fromJsonStream(json: InputStream, targetClass: Class<T>): T & Any {
return JavalinJackson(mapper).fromJsonString(json, targetClass)
Expand Down

0 comments on commit ae50b43

Please sign in to comment.