YamlDocument.Parse Method
Definition
Namespace: Corvus.Yaml
Assembly: Corvus.Text.Json.dll
Overloads
Parse(ReadOnlyMemory<byte>, YamlReaderOptions)
Parses UTF-8 YAML bytes and returns a JsonDocument containing the equivalent JSON representation.
public static JsonDocument Parse(ReadOnlyMemory<byte> utf8Yaml, YamlReaderOptions options)
Parameters
Returns
JsonDocument
A JsonDocument that must be disposed when no longer needed.
Exceptions
Applies To
| Product |
Versions |
| .NET |
9, 10 |
| .NET Standard |
2.0, 2.1 |
Parse(string, YamlReaderOptions)
Parses a YAML string and returns a JsonDocument containing the equivalent JSON representation.
public static JsonDocument Parse(string yaml, YamlReaderOptions options)
Parameters
| Name |
Type |
Description |
yaml |
string |
The YAML content as a string. |
options |
YamlReaderOptions |
Optional YAML reader options. (optional) |
Returns
JsonDocument
A JsonDocument that must be disposed when no longer needed.
Exceptions
Applies To
| Product |
Versions |
| .NET |
9, 10 |
| .NET Standard |
2.0, 2.1 |
Parse(ReadOnlySequence<byte>, YamlReaderOptions)
Parses UTF-8 YAML bytes from a ReadOnlySequence and returns a JsonDocument containing the equivalent JSON representation.
public static JsonDocument Parse(ReadOnlySequence<byte> utf8Yaml, YamlReaderOptions options)
Parameters
Returns
JsonDocument
A JsonDocument that must be disposed when no longer needed.
Exceptions
Applies To
| Product |
Versions |
| .NET |
9, 10 |
| .NET Standard |
2.0, 2.1 |
Parse(ReadOnlyMemory<char>, YamlReaderOptions)
Parses a YAML character memory and returns a JsonDocument containing the equivalent JSON representation.
public static JsonDocument Parse(ReadOnlyMemory<char> yaml, YamlReaderOptions options)
Parameters
Returns
JsonDocument
A JsonDocument that must be disposed when no longer needed.
Exceptions
Applies To
| Product |
Versions |
| .NET |
9, 10 |
| .NET Standard |
2.0, 2.1 |
Parse(Stream, YamlReaderOptions)
Parses UTF-8 YAML from a Stream and returns a JsonDocument containing the equivalent JSON representation. The stream will be read to completion.
public static JsonDocument Parse(Stream utf8YamlStream, YamlReaderOptions options)
Parameters
| Name |
Type |
Description |
utf8YamlStream |
Stream |
The stream containing UTF-8 encoded YAML bytes. |
options |
YamlReaderOptions |
Optional YAML reader options. (optional) |
Returns
JsonDocument
A JsonDocument that must be disposed when no longer needed.
Exceptions
Applies To
| Product |
Versions |
| .NET |
9, 10 |
| .NET Standard |
2.0, 2.1 |