Skip to content

YamlDocument.ConvertToJsonString Method

Definition

Namespace: Corvus.Yaml
Assembly: Corvus.Text.Json.dll

Overloads

Method Description
ConvertToJsonString(ReadOnlyMemory<byte>, YamlReaderOptions) Converts UTF-8 YAML bytes to a JSON string.
ConvertToJsonString(string, YamlReaderOptions) Converts a YAML string to a JSON string.

ConvertToJsonString(ReadOnlyMemory<byte>, YamlReaderOptions)

Converts UTF-8 YAML bytes to a JSON string.

public static string ConvertToJsonString(ReadOnlyMemory<byte> utf8Yaml, YamlReaderOptions options)

Parameters

Name Type Description
utf8Yaml ReadOnlyMemory<byte> The UTF-8 encoded YAML bytes.
options YamlReaderOptions Optional YAML reader options. (optional)

Returns

string

A string containing the JSON representation of the YAML content.

Exceptions

Exception Description
YamlException The YAML content is invalid.

Applies To

Product Versions
.NET 9, 10
.NET Standard 2.0, 2.1

ConvertToJsonString(string, YamlReaderOptions)

Converts a YAML string to a JSON string.

public static string ConvertToJsonString(string yaml, YamlReaderOptions options)

Parameters

Name Type Description
yaml string The YAML content as a string.
options YamlReaderOptions Optional YAML reader options. (optional)

Returns

string

A string containing the JSON representation of the YAML content.

Exceptions

Exception Description
YamlException The YAML content is invalid.

Applies To

Product Versions
.NET 9, 10
.NET Standard 2.0, 2.1

Collaborate with us on GitHub

The source for this content can be found on GitHub, where you can also create and review issues and pull requests.

Open an issue