kotlinx-serialization-mapper

A Kotlinx Serialization Extension for mapping between json objects and kotlin maps

License

License

Categories

Categories

Kotlin Languages Data Serialization Data Formats
GroupId

GroupId

tz.co.asoft
ArtifactId

ArtifactId

kotlinx-serialization-mapper-metadata
Last Version

Last Version

0.0.60
Release Date

Release Date

Type

Type

pom.sha512
Description

Description

kotlinx-serialization-mapper
A Kotlinx Serialization Extension for mapping between json objects and kotlin maps
Project URL

Project URL

https://github.com/aSoft-Ltd/kotlinx-serialization-mapper
Source Code Management

Source Code Management

https://github.com/aSoft-Ltd/kotlinx-serialization-mapper

Download kotlinx-serialization-mapper-metadata

Dependencies

compile (2)

Group / Artifact Type Version
org.jetbrains.kotlinx : kotlinx-serialization-json-metadata jar 1.0.1
org.jetbrains.kotlin : kotlin-stdlib-common jar 1.4.21

Project Modules

There are no modules declared in this project.

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.70") // please use the latest version possible
            }
        }
    }
}

Kotlin [android|jvm|js]

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

asoft

Versions

Version
0.0.60
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1