https://github.com/soenneker/soenneker.utils.yaml
A utility library handling useful YAML functionalities
https://github.com/soenneker/soenneker.utils.yaml
csharp dotnet json util utils yaml yamlutil
Last synced: about 1 month ago
JSON representation
A utility library handling useful YAML functionalities
- Host: GitHub
- URL: https://github.com/soenneker/soenneker.utils.yaml
- Owner: soenneker
- License: mit
- Created: 2026-03-05T18:53:17.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2026-05-01T12:24:48.000Z (about 2 months ago)
- Last Synced: 2026-05-01T14:19:53.883Z (about 2 months ago)
- Topics: csharp, dotnet, json, util, utils, yaml, yamlutil
- Language: C#
- Homepage: https://soenneker.com
- Size: 145 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
[](https://www.nuget.org/packages/soenneker.utils.yaml/)
[](https://github.com/soenneker/soenneker.utils.yaml/actions/workflows/publish-package.yml)
[](https://www.nuget.org/packages/soenneker.utils.yaml/)
[](https://github.com/soenneker/soenneker.utils.yaml/actions/workflows/codeql.yml)
#  Soenneker.Utils.Yaml
### A utility library handling useful YAML functionalities
## Installation
```
dotnet add package Soenneker.Utils.Yaml
```
## Usage
Register the utility (optional, for DI):
```csharp
services.AddYamlUtilAsSingleton(); // or AddYamlUtilAsScoped()
```
Use `IYamlUtil` for YAML/JSON conversion and validation:
- **ToYaml(object)** – Serialize any object to a YAML string.
- **FromYaml<T>(string)** – Deserialize YAML to a typed instance.
- **FromYaml(string)** – Deserialize YAML to an untyped object (dictionary/list).
- **JsonToYaml(string)** – Convert a JSON string to YAML.
- **YamlToJson(string)** – Convert a YAML string to JSON.
- **IsValidYaml(string)** – Return whether the string is valid YAML.
- **TryFromYaml<T>(string, out T?)** – Try to deserialize YAML to `T`.