{"id":13431726,"url":"https://github.com/aaubry/YamlDotNet","last_synced_at":"2025-03-16T12:31:13.121Z","repository":{"id":5022487,"uuid":"6181245","full_name":"aaubry/YamlDotNet","owner":"aaubry","description":"YamlDotNet is a .NET library for YAML","archived":false,"fork":false,"pushed_at":"2025-01-13T22:03:47.000Z","size":8807,"stargazers_count":2648,"open_issues_count":114,"forks_count":500,"subscribers_count":64,"default_branch":"master","last_synced_at":"2025-03-11T23:01:36.233Z","etag":null,"topics":["dotnet","parser","serialization","yaml"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aaubry.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE-libyaml","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},"funding":{"github":["EdwardCooke"]}},"created_at":"2012-10-11T21:43:57.000Z","updated_at":"2025-03-08T10:17:06.000Z","dependencies_parsed_at":"2023-07-05T20:16:55.593Z","dependency_job_id":"760ec1b1-0add-40a4-ad9c-6e5bfff1ca13","html_url":"https://github.com/aaubry/YamlDotNet","commit_stats":{"total_commits":926,"total_committers":103,"mean_commits":8.990291262135923,"dds":0.6706263498920086,"last_synced_commit":"9a5900fb35e5cb668a77d2449b96f8bc85c179ba"},"previous_names":[],"tags_count":95,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaubry%2FYamlDotNet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaubry%2FYamlDotNet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaubry%2FYamlDotNet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaubry%2FYamlDotNet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aaubry","download_url":"https://codeload.github.com/aaubry/YamlDotNet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243667979,"owners_count":20328036,"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","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":["dotnet","parser","serialization","yaml"],"created_at":"2024-07-31T02:01:05.386Z","updated_at":"2025-03-16T12:31:13.111Z","avatar_url":"https://github.com/aaubry.png","language":"C#","readme":"# YamlDotNet\n\n| Appveyor | NuGet |\n|----------|-------|\n|[![Build status](https://ci.appveyor.com/api/projects/status/github/aaubry/yamldotnet?svg=true)](https://ci.appveyor.com/project/aaubry/yamldotnet/branch/master)|  [![NuGet](https://img.shields.io/nuget/v/YamlDotNet.svg)](https://www.nuget.org/packages/YamlDotNet/)\n\n\nYamlDotNet is a YAML library for [netstandard and other .NET runtimes](#the-yamldotnet-library).\n\nYamlDotNet provides low level parsing and emitting of YAML as well as a high level object model similar to XmlDocument. A serialization library is also included that allows to read and write objects from and to YAML streams.\n\nYamlDotNet's conformance with YAML specifications:\n\n|            YAML Spec                | YDN Parser | YDN Emitter |\n|:-----------------------------------:|:----------:|:-----------:|\n|  [v1.1](https://yaml.org/spec/1.1/)  |     ✓      |      ✓      |\n|  [v1.2](https://yaml.org/spec/1.2/spec.html)  |     ✓      |             |\n\n\n## What is YAML?\n\nYAML, which stands for \"YAML Ain't Markup Language\", is described as \"a human friendly data serialization standard for all programming languages\". Like XML, it allows to represent about any kind of data in a portable, platform-independent format. Unlike XML, it is \"human friendly\", which means that it is easy for a human to read or produce a valid YAML document.\n\n## The YamlDotNet library\n\nThe library has now been successfully used in multiple projects and is considered fairly stable. It is compatible with the following runtimes:\n\n* netstandard 2.0\n* netstandard 2.1\n* .NET 6.0\n* .NET 8.0\n* .NET Framework 4.7\n\n## Quick start\n\nHere are some quick samples to get you started which can be viewed in [this fiddle](https://dotnetfiddle.net/CQ7ZKi).\n\n### Serialization from an object to a string\n\n```c#\nusing YamlDotNet.Serialization;\nusing YamlDotNet.Serialization.NamingConventions;\n...\n\n var person = new Person\n{\n    Name = \"Abe Lincoln\",\n    Age = 25,\n    HeightInInches = 6f + 4f / 12f,\n    Addresses = new Dictionary\u003cstring, Address\u003e{\n        { \"home\", new  Address() {\n                Street = \"2720  Sundown Lane\",\n                City = \"Kentucketsville\",\n                State = \"Calousiyorkida\",\n                Zip = \"99978\",\n            }},\n        { \"work\", new  Address() {\n                Street = \"1600 Pennsylvania Avenue NW\",\n                City = \"Washington\",\n                State = \"District of Columbia\",\n                Zip = \"20500\",\n            }},\n    }\n};\n\nvar serializer = new SerializerBuilder()\n    .WithNamingConvention(CamelCaseNamingConvention.Instance)\n    .Build();\nvar yaml = serializer.Serialize(person);\nSystem.Console.WriteLine(yaml);\n// Output: \n// name: Abe Lincoln\n// age: 25\n// heightInInches: 6.3333334922790527\n// addresses:\n//   home:\n//     street: 2720  Sundown Lane\n//     city: Kentucketsville\n//     state: Calousiyorkida\n//     zip: 99978\n//   work:\n//     street: 1600 Pennsylvania Avenue NW\n//     city: Washington\n//     state: District of Columbia\n//     zip: 20500\n```\n\n### Deserialization from a string to an object\n\n```c#\nusing YamlDotNet.Serialization;\nusing YamlDotNet.Serialization.NamingConventions;\n...\n\nvar yml = @\"\nname: George Washington\nage: 89\nheight_in_inches: 5.75\naddresses:\n  home:\n    street: 400 Mockingbird Lane\n    city: Louaryland\n    state: Hawidaho\n    zip: 99970\n\";\n\nvar deserializer = new DeserializerBuilder()\n    .WithNamingConvention(UnderscoredNamingConvention.Instance)  // see height_in_inches in sample yml \n    .Build();\n\n//yml contains a string containing your YAML\nvar p = deserializer.Deserialize\u003cPerson\u003e(yml);\nvar h = p.Addresses[\"home\"];\nSystem.Console.WriteLine($\"{p.Name} is {p.Age} years old and lives at {h.Street} in {h.City}, {h.State}.\");\n// Output:\n// George Washington is 89 years old and lives at 400 Mockingbird Lane in Louaryland, Hawidaho.\n```\n\n## More information\n\nMore information can be found in the [project's wiki](https://github.com/aaubry/YamlDotNet/wiki).\n\n## Installing\n\nJust install the [YamlDotNet NuGet package](http://www.nuget.org/packages/YamlDotNet/):\n\n```\nPM\u003e Install-Package YamlDotNet\n```\n\nIf you do not want to use NuGet, you can [download binaries here](https://ci.appveyor.com/project/aaubry/yamldotnet).\n\nYamlDotNet is also available on the [Unity Asset Store](https://assetstore.unity.com/packages/tools/integration/yamldotnet-for-unity-36292).\n\n## Contributing\n\nPlease read [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\n\n## Release notes\n\nPlease see the Releases at https://github.com/aaubry/YamlDotNet/releases\n\n","funding_links":["https://github.com/sponsors/EdwardCooke"],"categories":["Frameworks, Libraries and Tools","HarmonyOS","C\\#","dotnet","框架, 库和工具","🗒️ Cheatsheets","Serialization","DSL","C# #"],"sub_categories":["Serialization","Windows Manager","序列化","📦 Libraries"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faaubry%2FYamlDotNet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faaubry%2FYamlDotNet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faaubry%2FYamlDotNet/lists"}