kotlin-dsv
Introduction: Kotlin Multiplatform library for working with delimiter-separated values.
Tags:
Introduction
Kotlin DSV is a library for working with delimiter-separated values (CSV, TSV, and custom formats) in Kotlin Multiplatform projects.
Features:
- Type-safe serialization using kotlinx.serialization
- Streaming support for large files via kotlinx.io
- Customizable delimiters, quoting, and naming strategies
- Multiplatform support for JVM, JS, Native, and WASM targets
Getting Started
Add Kotlin DSV to your project:
dependencies {
implementation("dev.sargunv.kotlin-dsv:kotlin-dsv:VERSION")
}
Quick Start
@Serializable
data class Person(val name: String, val age: Int, val email: String?)
// Encode to CSV string
val people = listOf(
Person("A", 30, "a@example.com"),
Person("B", 25, null)
)
val csv = Csv.encodeToString(people)
// Decode from CSV string
val decoded = Csv.decodeFromString<Person>(csv)
See the project site for more info and examples.
