toml
TOML support for Koto.
from_string
|String| -> Any
Deserializes a string containing TOML data, returning a structured Koto value.
Example
data = r"
string = 'O_o'
[nested]
number = -1.2
[[entries]]
foo = 'bar'
[[entries]]
foo = 'baz'
"
result = toml.from_string data
result.string
#: O_o
result.nested.number
#: -1.2
result.entries.foo
#: bar
result.entries.foo
#: baz
to_string
|Any| -> String
Returns a string containing the input value serialized as TOML data.
Example
data =
string: '>_>'
nested:
number: 99
entries:
toml.to_string data
#: string = ">_>"
check!
#: [nested]
#: number = 99
check!
#: [[entries]]
#: foo = "bar"
check!
#: [[entries]]
#: foo = "baz"
check!