Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jurgc11/yakl
YAKL is a Kotlin native YAML 1.2 processor
https://github.com/jurgc11/yakl
Last synced: 2 months ago
JSON representation
YAKL is a Kotlin native YAML 1.2 processor
- Host: GitHub
- URL: https://github.com/jurgc11/yakl
- Owner: jurgc11
- License: apache-2.0
- Created: 2020-03-27T20:55:27.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-04-01T21:37:49.000Z (almost 5 years ago)
- Last Synced: 2024-08-02T09:26:27.659Z (6 months ago)
- Language: Kotlin
- Homepage:
- Size: 374 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-kotlin-multiplatform - YAKL - A YAML 1.2 processor (Libraries / Serializer)
README
YAKL is a Kotlin native YAML 1.2 processor.
It is a straight port of [SnakeYAML Engine](https://bitbucket.org/asomov/snakeyaml/src/master/)
Currently this is very experimental. Limitations include:
* Only UTF-8 is supported
* Depends on a unreleased branch of kotlinx.io (https://github.com/Kotlin/kotlinx-io/tree/e5l/bytes)
* Since Kotlin/native doesn't have any file handling yet, VERY basic code for reading files is included
* Recursive structures cause an infinite loop
* Only support macOS and Linux, although other platforms should be easy to add## Examples
### Deserialisation
```kotlin
val loadSettings = LoadSettings() // This can be used to configure how the yaml is deserialised.
val load = Load(loadSettings)
val yaml = """
- item1
- item2
- item3
"""
val result = load.loadFromString(yaml) as List
println(result)
```
Prints `[item1, item2, item3]`### Serialisation
```kotlin
// Override the default flow style so the list is output with one element per line
val settings = DumpSettings(defaultFlowStyle = FlowStyle.BLOCK)
val dump = Dump(settings)
val result = dump.dumpToString(listOf("item1", "item2", "item3"))
println(result)
```
Prints```yaml
- item1
- item2
- item3
```