Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
YAML
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Basic components=== Conventional block format uses a hyphen+space to begin a new item in list. <syntaxhighlight lang="yaml"> --- # Favorite movies - Casablanca - North by Northwest - The Man Who Wasn't There </syntaxhighlight> Optional inline format is delimited by comma+space and enclosed in brackets (similar to [[JavaScript Object Notation|JSON]]).<ref>{{cite web |url=http://www.jigocloud.com/en/blog/yaml-is-json |title=Cloud Based Management apps |website=JigoCloud.com |access-date=2016-09-28 |archive-url=https://web.archive.org/web/20160917202144/http://www.jigocloud.com/en/blog/yaml-is-json |archive-date=2016-09-17 |url-status=dead }}</ref> <syntaxhighlight lang="yaml"> --- # Shopping list [milk, pumpkin pie, eggs, juice] </syntaxhighlight> Keys are separated from values by a colon+space. Indented blocks, common in YAML data files, use indentation and new lines to separate the key/value pairs. Inline blocks, common in YAML data streams, use comma+space to separate the key/value pairs between braces. <syntaxhighlight lang="yaml"> --- # Indented Block name: John Smith age: 33 --- # Inline Block {name: John Smith, age: 33} </syntaxhighlight> Strings do not require quotation marks. There are two ways to write multi-line strings, one preserving newlines (using the <code>|</code> character) and one that folds the newlines (using the {{code|>}} character), both followed by a newline character. <syntaxhighlight lang="yaml"> data: | There once was a tall man from Ealing Who got on a bus to Darjeeling It said on the door "Please don't sit on the floor" So he carefully sat on the ceiling </syntaxhighlight> By default, the leading indentation (of the first line) and trailing whitespace are stripped, though other behavior can be explicitly specified. <syntaxhighlight lang="yaml"> data: > Wrapped text will be folded into a single paragraph Blank lines denote paragraph breaks </syntaxhighlight> Folded text converts newlines to spaces and removes leading whitespace. <syntaxhighlight lang="yaml"> --- # The Smiths - {name: John Smith, age: 33} - name: Mary Smith age: 27 - [name, age]: [Rae Smith, 4] # sequences as keys are supported --- # People, by gender men: [John Smith, Bill Jones] women: - Mary Smith - Susan Williams </syntaxhighlight> Objects and lists are important components in yaml and can be mixed. The first example is a list of key-value objects, all people from the Smith family. The second lists them by gender; it is a key-value object containing two lists.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)