writeToString

fun writeToString(data: Map<String, Any?>, comments: Map<String, CommentData> = emptyMap()): String

Renders serialized configuration data to a YAML-formatted string.

This is the in-memory variant of write and is used internally by YamlConfigManager.toDebugString for debug output with secret masking.

Example:

val yaml = YamlWriter.writeToString(
data = mapOf("name" to "MyApp", "debug" to true),
comments = mapOf("debug" to CommentData(listOf("Enable debug mode"), CommentPlacement.ABOVE))
)
// Returns:
// name: MyApp
//
// # Enable debug mode
// debug: true

Return

The YAML-formatted string.

Since

1.0

Parameters

data

The serialized configuration data as a string-keyed map.

comments

Optional comment metadata to embed in the output.

See also