Skip to content

aSoft-Ltd/kotlinx-serialization-mapper

Repository files navigation

Kotlinx Serialization Mapper

badge badge badge badge badge

Introduction

Built on top of the famous kotlinx-serialization-json, this library helps to serialize between json maps and kotlin maps.

Samples

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 map

Setup:Gradle

Adding kotlinx-serialization-mapper as a dependency becomes as easy as just

Kotlin Multiplatform

kotlin {
    // . . .
    sourceSets {
        val commonTest by getting {
            dependencies {
                implementation("tz.co.asoft:kotlinx-serialization-mapper:0.0.71") // please use the latest version possible
            }
        }
    }
}

Kotlin [android|jvm|js]

kotlin {
    // . . .
    dependencies {
        implementationTest("tz.co.asoft:kotlinx-serialization-mapper:0.0.71")
    }
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors