encodeToDocument

Encodes the given value into a valid TOML document. If value does not serialize to a valid TOML document (i.e. a map of zero or more keys), an TomlException.SerializationError is thrown.