Skip to content

YamlDocument.ConvertToYamlString Method

Definition

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

Overloads

Method Description
ConvertToYamlString(JsonElement, YamlWriterOptions) Converts a JsonElement to a YAML string.
ConvertToYamlString(string, YamlWriterOptions) Converts a JSON string to a YAML string.
ConvertToYamlString(ReadOnlySpan<byte>, YamlWriterOptions) Converts UTF-8 JSON bytes to a YAML string.

ConvertToYamlString(JsonElement, YamlWriterOptions)

Converts a JsonElement to a YAML string.

public static string ConvertToYamlString(JsonElement element, YamlWriterOptions options)

Parameters

Name Type Description
element JsonElement The JSON element to convert.
options YamlWriterOptions Optional YAML writer options. (optional)

Returns

string

A string containing the YAML representation of the JSON element.

Applies To

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

ConvertToYamlString(string, YamlWriterOptions)

Converts a JSON string to a YAML string.

public static string ConvertToYamlString(string json, YamlWriterOptions options)

Parameters

Name Type Description
json string The JSON content as a string.
options YamlWriterOptions Optional YAML writer options. (optional)

Returns

string

A string containing the YAML representation of the JSON content.

Applies To

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

ConvertToYamlString(ReadOnlySpan<byte>, YamlWriterOptions)

Converts UTF-8 JSON bytes to a YAML string.

public static string ConvertToYamlString(ReadOnlySpan<byte> utf8Json, YamlWriterOptions options)

Parameters

Name Type Description
utf8Json ReadOnlySpan<byte> The UTF-8 encoded JSON bytes.
options YamlWriterOptions Optional YAML writer options. (optional)

Returns

string

A string containing the YAML representation of the JSON content.

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