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