YAML
![]() | The English used in this article or section may not be easy for everybody to understand. (March 2023) |
This article does not have any sources. (March 2023) |
![]() | |
Filename extension | .yml, .yaml |
---|---|
Internet media type | text/yaml, text/x-yaml |
Type code | TEXT |
Uniform Type Identifier (UTI) | public.yaml |
Magic number | %YAML |
Developed by | YAML.org |
Latest release | 1.2 (October 21, 2009 ) |
Type of format | data serialization format |
Extended from | JSON |
YAML (YAML Ain't Markup Language) is a human-readable data serialization format that is commonly used for configuration files and data exchange between programming languages. It is often used in conjunction with web development frameworks and other systems that need to share data.
YAML was first released in 2001 by Ingy döt Net, Brian Ingerson, and Oren Ben-Kiki. It was designed to be a more user-friendly alternative to other markup languages like XML and JSON. YAML's syntax is designed to be easy to read and write, using whitespace and indentation to organize data.
YAML is often used for configuration files, such as those used by web development frameworks like Ruby on Rails and Django. It is also commonly used for data exchange between programming languages, especially in systems that use different programming languages for different components.
One of the key features of YAML is that it is designed to be easy for humans to read and write, while still being machine-readable. This makes it a popular choice for configuration files, as it allows developers to easily modify settings without needing to understand complex markup languages.
YAML is a superset of JSON, meaning that any valid JSON document is also a valid YAML document. However, YAML adds additional features, such as support for comments, anchors and aliases, and complex data types like maps and lists.
YAML has been implemented in many programming languages, including Python, Ruby, Java, and Perl. It is also supported by many text editors and IDEs, which can provide syntax highlighting and other features to make working with YAML easier.
Overall, YAML is a flexible and user-friendly data serialization format that is widely used in web development, system configuration, and other areas where data needs to be exchanged between different components.
Syntax[change | change source]
YAML's syntax is designed to be simple and easy to read. It uses indentation and whitespace to organize data, rather than relying on explicit tags or markup. Here is an example of a YAML document:
name: John Smith
age: 35
In this example, the document contains three key-value pairs, where the keys are `name`, `age`, and `email`, and the values are `John Smith`, `35` , respectively.
- name: John Smith
age: 35
email: john AT example.com
- name: Jane Doe
age: 28
email: jane AT example.com
YAML also supports more complex data structures, like maps and lists. Here is an example of a YAML document that contains a map and a list: