Import std.data.yaml
Yaml
struct
Public Struct Yaml
What reads and writes YAML documents, in its Static Methods.
Examples
Local document = Try Yaml.Read(r"""
name: Ada
langs:
- en
- fr
age: 36
""")
Expect(document.Path("langs[0]")?.AsString() == "en")
Expect(document.Path("age")?.AsInt() == 36)
Expect((Try Yaml.Read(Yaml.Write(document))) == document)-
The document
textholds, or Null for a text of none. An integer past what an Int64 holds is a UINT, and past a UInt64 a Double. Throws a ParseError, with its line and column, of UNEXPECTED_END fortextthat ends inside a quoted scalar or a flow collection, of OUT_OF_RANGE for an !!int past what a UInt64 holds, of OTHER for a tag that isn't the core schema's, a key that's a mapping or a sequence, or a text of more than one document, which ReadAll reads, at the second's start, and of SYNTAX for the rest that isn't YAML 1.2. -
Each document
textholds, in order. Throws a ParseError as Read does, but for more than one document. -
valueas a document: an Object as a block mapping, an Array as a block sequence, an empty one as {} or [], and a String plain where the core schema reads it back as that String, else in double quotes. Panics whenvalueholds bytes, which the core schema hasn't got. -
valuesas documents, each after a "---". Panics as Write does.
Report an issue with this page or with FutureBlitz on GitHub.