Thanks to visit codestin.com
Credit goes to github.com

Skip to content

lukelast/ktoon

Repository files navigation

ktoon

.github/workflows/gradle.yml SPEC v3.0.1 Kotlin Kotlin License: MIT

Kotlin serializer for TOON (Token-Oriented Object Notation).

To learn about the TOON format and why you should use it read the official website:

Features

  • Full TOON 3.0.1 Spec Support - Complete implementation of the TOON format specification, including tabular arrays, key folding, and delimeters. 400+ tests.
  • Fully Featured
    • Encode Kotlin data classes to TOON
    • Encode JSON to TOON
    • Decode TOON to Kotlin data classes
  • Minimal Dependencies - Only depends on kotlinx.serialization, no additional runtime dependencies.
  • High Performance - CharArray-based encoding optimized for minimal allocations and fast string operations.
  • Flexible Configuration - Configurable delimiters, indentation, and key folding.

Add to your project (JitPack)

Check JitPack for versions and more installation instructions: https://jitpack.io/#lukelast/ktoon

Using the Gradle Kotlin DSL:

// settings.gradle.kts
dependencyResolutionManagement {
    repositories {
        mavenCentral()
        maven(url = "https://jitpack.io")
    }
}
// build.gradle.kts
dependencies {
    implementation("com.github.lukelast:ktoon:VERSION")
}

Basic usage

import com.lukelast.ktoon.Ktoon
import kotlinx.serialization.Serializable

@Serializable
data class User(val id: Int, val name: String)

fun main() {
    val encoded = Ktoon.Default.encodeToString(User(1, "Alice"))
    println(encoded)
}

Dependencies

Demo project

Check out the demo project in the demo directory for more examples on how to use Ktoon. demo/README.md)

Development

See the development guide for how to do development.

About

A Kotlin serialization library for TOON (Token-Oriented Object Notation)

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •  

Languages