
Facilitates serialization between JSON maps and native maps, leveraging a JSON serialization library. Simplifies conversion processes, enhancing data manipulation and retrieval in applications.
Built on top of the famous kotlinx-serialization-json, this library helps to serialize between json maps and kotlin
maps.
Getting an map from a json
val json = """
{
"environment": "production",
"logging": "warnings",
"key": "SOME_TEST_KEY",
"bool": true,
"integer": 43,
"double": 46.55
}
""".trimIndent()
val map = Mapper.decodeFromString(json)
val environment: String by map
val logging: String by map
val key: String by map
val bool: Boolean by map
val integer: Int by map
val double: Double by mapAdding kotlinx-serialization-mapper as a dependency becomes as easy as just
kotlin {
// . . .
sourceSets {
val commonTest by getting {
dependencies {
implementation("tz.co.asoft:kotlinx-serialization-mapper:0.0.71") // please use the latest version possible
}
}
}
}kotlin {
// . . .
dependencies {
implementationTest("tz.co.asoft:kotlinx-serialization-mapper:0.0.71")
}
}Built on top of the famous kotlinx-serialization-json, this library helps to serialize between json maps and kotlin
maps.
Getting an map from a json
val json = """
{
"environment": "production",
"logging": "warnings",
"key": "SOME_TEST_KEY",
"bool": true,
"integer": 43,
"double": 46.55
}
""".trimIndent()
val map = Mapper.decodeFromString(json)
val environment: String by map
val logging: String by map
val key: String by map
val bool: Boolean by map
val integer: Int by map
val double: Double by mapAdding kotlinx-serialization-mapper as a dependency becomes as easy as just
kotlin {
// . . .
sourceSets {
val commonTest by getting {
dependencies {
implementation("tz.co.asoft:kotlinx-serialization-mapper:0.0.71") // please use the latest version possible
}
}
}
}kotlin {
// . . .
dependencies {
implementationTest("tz.co.asoft:kotlinx-serialization-mapper:0.0.71")
}
}