Skip to content

Commit

Permalink
Merge pull request #151 from walt-id/fix-json-string
Browse files Browse the repository at this point in the history
added fromJsonString fun
  • Loading branch information
ahmedsmiai authored Sep 13, 2023
2 parents 0d35684 + ae50b43 commit a4a869f
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 a4a869f

Please sign in to comment.