kaml

Build Status Coverage License Maven Central

What is this?

This library adds YAML support to kotlinx.serialization.

YAML version 1.2 is supported.

This is a very rough initial version:

  • Currently, only parsing YAML is supported. Emitting YAML will be added in a future version.
  • Many operations are not yet optimised for performance.
  • Only the JVM is supported, Kotlin/Native support will be added in a future version.

Usage sample

@Serializable
data class Team(
    val leader: String,
    val members: List<String>
)

val input = """
        leader: Amy
        members:
          - Bob
          - Cindy
          - Dan
    """.trimIndent()

val result = Yaml.default.parse(Team.serializer(), input)

println(result)

Contributing to kaml

Pull requests and bug reports are always welcome!

kaml uses batect to simplify development environment setup:

  • To build the library: ./batect build
  • To run the tests and static analysis tools: ./batect check
  • To run the tests and static analysis tools continuously: ./batect continuousCheck

Other commands are available by running ./batect --list-tasks

compile "com.charleskorn.kaml:kaml:0.4.0"

Related Libraries

moshi-pristine-models

Moshi add-on to programmatically define mapping between models & JSON

Last updated 3 mins ago

kaml

YAML support for kotlinx.serialization

Last updated 3 mins ago