{"id":22622585,"url":"https://github.com/jonbeebe/yamlserialization","last_synced_at":"2026-05-03T19:31:58.214Z","repository":{"id":85829929,"uuid":"149565921","full_name":"jonbeebe/YAMLSerialization","owner":"jonbeebe","description":"An Swift Package for converting between YAML and the equivalent Foundation objects.","archived":false,"fork":false,"pushed_at":"2018-09-22T02:39:19.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-04-14T08:40:26.839Z","etag":null,"topics":["swift","yaml"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonbeebe.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":"2018-09-20T07:00:01.000Z","updated_at":"2018-09-22T02:39:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"f57d877a-371e-41d8-acf8-0bde0dcf080d","html_url":"https://github.com/jonbeebe/YAMLSerialization","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jonbeebe/YAMLSerialization","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonbeebe%2FYAMLSerialization","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonbeebe%2FYAMLSerialization/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonbeebe%2FYAMLSerialization/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonbeebe%2FYAMLSerialization/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonbeebe","download_url":"https://codeload.github.com/jonbeebe/YAMLSerialization/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonbeebe%2FYAMLSerialization/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32582539,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T06:36:36.687Z","status":"ssl_error","status_checked_at":"2026-05-03T06:36:09.306Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["swift","yaml"],"created_at":"2024-12-08T23:16:47.552Z","updated_at":"2026-05-03T19:31:58.198Z","avatar_url":"https://github.com/jonbeebe.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# YAMLSerialization\n\nby [Jonathan Beebe](https://jonbeebe.net)\n\nAn SPM package that converts between YAML and the equivalent Foundation objects. YAMLSerialization depends on the [LibYAML](https://github.com/yaml/libyaml) C library and [JSONSerialization](https://developer.apple.com/documentation/foundation/jsonserialization) to do the heavy lifting. The API was made to be similiar to JSONSerialization for familiarity.\n\nRequires a mininum version of **Swift 4.2**.\n\n[API Documentation](./Documentation.md)\n\n## Prerequisites\n\nYAMLSerialization depends on the external [LibYAML](https://github.com/yaml/libyaml) system library and pkg-config. Installation instructions for macOS, Ubuntu, and Fedora are below.\n\n### macOS\n\n```\n$ brew install libyaml\n$ brew install pkg-config\n```\n\n### Ubuntu\n\n```\n# apt-get update\n# apt-get install libyaml-dev\n# apt-get install pkg-config\n```\n\n### Fedora\n\n```\n# dnf install libyaml-devel\n# dnf install pkg-config\n```\n\n## Example\n\n```\nimport YAMLSerialization\n\nlet yamlStr = \"\"\"\n    ---\n    bool_val: true\n    double_val: 10.4\n    int_val: 3\n    string_val: Hello, World\n    fruits_array:\n        - Apple\n        - Banana\n        - Strawberry\n        - Mango\n    ages:\n        jane: 18\n        josh: 16\n        echo: 100\n    \"\"\"\n\nlet yaml = try! YAMLSerialization.yamlObject(with: yamlStr) as! [String: Any]\n\n// Extract individual values from YAML object\nlet bool = yaml[\"bool_val\"] as! Bool     // true\nlet double yaml[\"double_val\"] as! Double // 10.4\nlet int = yaml[\"int_val\"] as! Int        // 3\nlet str = yaml[\"string_val\"] as! String  // Hello, World\n\n// Arrays and Dictionaries\nlet fruits = yaml[\"fruits_array\"] as! [String]\nprint(fruits[2]) // Strawberry\nlet ages = yaml[\"ages\"] as! [String: Int]\nprint(ages[\"josh\"]) // 14\n\ndump(yaml)\n```\n\nAlternatively, you can also pass a Data object as the first argument:\n\n```\nlet yamlData = yamlStr.data(using: .utf8)\nlet yaml = try! YAMLSerialization.yamlObject(with: yamlData) as! [String: Any]\n```\n\n\n## Status\n\n- [ ] Parse multiple YAML documents from a single Data or String object and return a `[[String: Any]]` array.\n- [ ] Implement `isValidYAMLObject(_:)`\n- [ ] Creating YAML data via `data(withYAMLObject:options:)`\n- [ ] Proper tests\n- [x] Example\n- [x] Reading YAML objects from Data\n- [x] Reading YAML objects from String\n\n## LICENSE\n\n[ISC License](./LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonbeebe%2Fyamlserialization","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonbeebe%2Fyamlserialization","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonbeebe%2Fyamlserialization/lists"}