ESC
Type to search...
S
Soli Docs

Toml / Yaml Classes

Config-format parse/stringify over the same Value model as JSON. Malformed input produces clean errors naming the parser.

Toml.parse(str) / Toml.stringify(hash)

TOML documents map onto hashes of scalars, arrays, and nested tables. Stringify raises on null values — TOML cannot represent them.

let config = Toml.parse(slurp("config.toml"));
config["owner"]["name"];

Toml.stringify({ "title": "demo", "owner": { "name": "Ann" } });

Yaml.parse(str) / Yaml.stringify(value)

YAML parses into whatever shape the document has — hash, array, or scalar. Stringify accepts any serializable value.

let spec = Yaml.parse(slurp("openapi.yaml"));
spec["paths"]["/users"]["get"]["summary"];

Yaml.stringify({ "name": "demo", "counts": [1, 2] });