Skip to content

Lepinoid/uuid-serializer

Repository files navigation

uuid-serializer

LatestVersion ➡️

📖 Simple Uuid serializer library

Gradle

KotlinDSL:

repositories {
     maven { 
         name = "lepinoid"
         url = uri("https://lepinoid.github.io/maven-repo/")
     }
}

dependencies {
  implementation("net.lepinoid:uuid-serializer-jvm:$VERSION")
}

Multiplatform:

commonMain {
    dependencies {
        implementation("net.lepinoid:uuid-serializer:$VERSION")
    }
}

Examples

@Serializable
class SomeClass(
    @Serializable(with = UuidSerialzier::class)
    val uuid: Uuid
)
fun main() {
    val uuid = uuid4()
    val json = Json.encodeToString(UuidSerializer, uuid)
    val decoded = Json.decodeFromString<Uuid>(UuidSerializer, json)
}