File tree Expand file tree Collapse file tree
typedrest-serializers-jackson/src/main/kotlin/net/typedrest/serializers Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22okhttp3 = " 5.3.2"
33uri-templates = " 2.1.8"
44kotlinx-serialization = " 1.10.0"
5- jackson = " 2.19.0 "
5+ jackson = " 3.0.4 "
66moshi = " 1.15.2"
77
88[libraries ]
99okhttp3 = { module = " com.squareup.okhttp3:okhttp" , version.ref = " okhttp3" }
1010okhttp3-mockwebserver = { module = " com.squareup.okhttp3:mockwebserver" , version.ref = " okhttp3" }
1111uri-templates = { module = " com.damnhandy:handy-uri-templates" , version.ref = " uri-templates" }
1212kotlinx-serialization-json = { module = " org.jetbrains.kotlinx:kotlinx-serialization-json" , version.ref = " kotlinx-serialization" }
13- jackson-databind = { module = " com.fasterxml .jackson.core:jackson-databind" , version.ref = " jackson" }
14- jackson-kotlin = { module = " com.fasterxml .jackson.module:jackson-module-kotlin" , version.ref = " jackson" }
13+ jackson-databind = { module = " tools .jackson.core:jackson-databind" , version.ref = " jackson" }
14+ jackson-kotlin = { module = " tools .jackson.module:jackson-module-kotlin" , version.ref = " jackson" }
1515moshi = { module = " com.squareup.moshi:moshi" , version.ref = " moshi" }
1616moshi-kotlin = { module = " com.squareup.moshi:moshi-kotlin" , version.ref = " moshi" }
Original file line number Diff line number Diff line change 11package net.typedrest.serializers
22
3- import com.fasterxml. jackson.databind.ObjectMapper
4- import com.fasterxml. jackson.module.kotlin.registerKotlinModule
3+ import tools. jackson.databind.json.JsonMapper
4+ import tools. jackson.module.kotlin.kotlinModule
55import okhttp3.*
66import okhttp3.RequestBody.Companion.toRequestBody
77
@@ -11,7 +11,7 @@ import okhttp3.RequestBody.Companion.toRequestBody
1111 * @param mapper The Jackson object mapper to use for serializing and deserializing.
1212 */
1313open class JacksonJsonSerializer @JvmOverloads constructor(
14- private val mapper : ObjectMapper = ObjectMapper ().registerKotlinModule ()
14+ private val mapper : JsonMapper = JsonMapper .builder ().addModule(kotlinModule()).build ()
1515) : AbstractJsonSerializer() {
1616 override fun <T > serialize (entity : T , type : Class <T >): RequestBody =
1717 mapper.writeValueAsString(entity).toRequestBody(mediaTypeJson)
You can’t perform that action at this time.
0 commit comments