{"id":15286519,"url":"https://github.com/him188/yamlkt","last_synced_at":"2025-09-14T20:06:34.467Z","repository":{"id":40305439,"uuid":"245191078","full_name":"Him188/yamlkt","owner":"Him188","description":"Multiplatform YAML parser \u0026 serializer for kotlinx.serialization written in pure Kotlin","archived":false,"fork":false,"pushed_at":"2025-02-10T19:19:08.000Z","size":609,"stargazers_count":139,"open_issues_count":30,"forks_count":15,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-09-09T01:08:33.050Z","etag":null,"topics":["kotlin","multiplatform","serialization","yaml"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Him188.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-05T14:54:59.000Z","updated_at":"2025-07-30T03:21:02.000Z","dependencies_parsed_at":"2025-02-28T07:00:35.446Z","dependency_job_id":"0f48dbb5-7389-4dd7-9bcf-e8a11444f763","html_url":"https://github.com/Him188/yamlkt","commit_stats":null,"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"purl":"pkg:github/Him188/yamlkt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Him188%2Fyamlkt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Him188%2Fyamlkt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Him188%2Fyamlkt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Him188%2Fyamlkt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Him188","download_url":"https://codeload.github.com/Him188/yamlkt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Him188%2Fyamlkt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275160370,"owners_count":25415767,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-14T02:00:10.474Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["kotlin","multiplatform","serialization","yaml"],"created_at":"2024-09-30T15:16:14.950Z","updated_at":"2025-09-14T20:06:34.424Z","avatar_url":"https://github.com/Him188.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# YamlKt\n\n![Gradle CI](https://github.com/mamoe/yamlkt/workflows/Gradle%20CI/badge.svg?branch=master)\n[![Download](https://api.bintray.com/packages/mamoe/yamlkt/yamlkt/images/download.svg)](https://bintray.com/mamoe/yamlkt/yamlkt/)\n\n[kotlinx.serialization]: https://github.com/kotlin/kotlinx.serialization\n\nFast multi-platform YAML with comments support for [kotlinx.serialization]\n\nThis project is in alpha state.\n\n## Setup\n\nThird-party formats for [kotlinx.serialization] is strongly dependent on the versions of `kotlinx-serialization-core` and Kotlin compiler.\n\nThe table below shows recommended version parings.\nNote that normally you may use higher versions within the minor version range, e.g. preferring `1.3.3` or `1.3.0` over `1.3.2`.\n\n| yamlkt | Kotlin | kotlinx-serialization-core |\n|:------:|:------:|:--------------------------:|\n| 0.3.3  | 1.3.70 |           0.20.0           |\n| 0.5.3  | 1.4.0  |          1.0.0-RC          |\n| 0.6.0  | 1.4.10 |         1.0.0-RC2          |\n| 0.8.0  | 1.4.10 |           1.0.1            |\n| 0.9.0  | 1.4.30 |          1.1.0-RC          |\n| 0.10.2 | 1.5.20 |           1.2.1            |\n| 0.10.2 | 1.5.31 |           1.3.0            |\n| 0.11.0 | 1.6.21 |           1.3.3            |\n| 0.12.0 | 1.6.21 |           1.3.3            |\n| 0.12.0 | 1.7.10 |           1.3.3            |\n| 0.13.0 | 1.8.0  |           1.5.0            |\n\n#### Gradle\n\n```kotlin\nrepositories {\n    mavenCentral()\n}\n```\n\n```kotlin\ndependencies {\n    implementation(\"net.mamoe.yamlkt:yamlkt:0.13.0\")\n}\n```\n\n**If your project is multiplatform, you need only to add this dependency for commonMain:**\n\n```kotlin\ncommonMain {\n    dependencies {\n        implementation(\"net.mamoe.yamlkt:yamlkt:0.13.0\")\n    }\n}\n```\n\n#### Maven\n\nOnly JVM target is available for Maven.\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003enet.mamoe.yamlkt\u003c/groupId\u003e\n    \u003cartifactId\u003eyamlkt-jvm\u003c/artifactId\u003e\n    \u003cversion\u003e0.13.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## Overview\n\nThis library supports:\n\n- fast deserializing YAML text to a structured object\n- contextual and polymorphic serialization: `@Contextual`, `@Polymorphic`\n- dynamic types: `YamlDynamicSerializer` which works on `Any`\n- `YamlElement` wrapper classes, allowing `YamlMap.getInt`, `YamlMap.getLong`\n- comments encoding (Using annotation `Comment`)\n\nThe features that aren't yet supported:\n\n- Anchors (`*`, `\u0026`)\n- Explicit types (e.g. `!!map`)\n- Multiline string (`|` and `\u003e` are partially supported; `\\` is not)\n\n## Usage\n\n### Serialize / deserialize with compiled serializers\n\nThis is the fastest and recommended way.\n\n```kotlin\n@Serializable\ndata class Test(\n    val test: String,\n    val optional: String = \"optional\", // Having default value means optional\n    val nest: Nested,\n    val list: List\u003cString\u003e\n) {\n    @Serializable\n    data class Nested(\n        val numberCast: Int\n    )\n}\n\nprintln(Yaml.parse(Test.serializer(), \"\"\"\ntest: testString\nnest: \n  numberCast: 0xFE\nlist: [str, \"str2\"]\n\"\"\"))\n```\n\n### Contextual serializing / deserializing\n\nYamlKt provides a contextual serializer `YamlDynamicSerializer` for `Any`  \nand `YamlNullDynamicSerializer` for `Any?`\n\nBy default, `YamlDynamicSerializer` is installed to `Any`.  \nYou can start by using `@Contextual`:\n\n```kotlin\n@Serializable\ndata class Test(\n    val any: @Contextual Any\n)\n\nYaml.parse(Test.serializer(), yamlText)\n```\n\nFor input YAML text:\n\n```yaml\ntest: { key1: v1, key2: [v2, v3, v4] }\n```\n\nAlternatively, you can deserialize without any class:\n\n```kotlin\nval map: Map\u003cString?, Any?\u003e = Yaml.parseMap(\"\"\"test: { key1: v1, key2: [v2, v3, v4] }\"\"\")\n```\n\n### `YamlElement`\n\n`YamlElement` is a type-safe way to deserialize without descriptors.\n\n```kotlin\nval map: YamlMap = Yaml.decodeYamlMapFromString(\"\"\"test: { key1: v1, key2: [v2, v3, v4] }\"\"\")\n```\n\n### Comments\n\nAnnotate your comments to a field(property) using `@Comment`:  \nExample:\n\n```kotlin\n@Serializable\ndata class User(\n  @Comment(\"The name of the user\")\n  val name: String = \"value\"\n)\n```\n\ngives yaml text:\n\n```yaml\n# The name of the user\nname: \"\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhim188%2Fyamlkt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhim188%2Fyamlkt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhim188%2Fyamlkt/lists"}