YAML Tutorial
YAML Useful Resources
Selected Reading
- YAML – JSON Schema
- YAML – Failsafe Schema
- YAML – Block Sequences
- YAML – Flow Mappings
- YAML – Sequence Styles
- YAML – Block Styles
- YAML – Flow Styles
- YAML – Block Scalar Header
- YAML – Node Properties
- YAML – Character Streams
- YAML – Syntax Primitives
- YAML – Syntax Characters
- YAML – Information Models
- YAML – Processes
- YAML – Full Length Example
- YAML – Scalars and Tags
- YAML – Collections and Structures
- YAML – Comments
- YAML – Indentation and Separation
- YAML – Basics
- YAML – Introduction
- YAML - Home
YAML Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
YAML – Block Scalar Header
YAML - Block Scalar Header
In this chapter, we will focus on various scalar types which are used for representing the content. In YAML, comments may either precede or follow scalar content. It is important to note that comments should not be included within scalar content.
Note that all flow scalar styles can include multiple pnes, except with usage in multiple keys.
The representation of scalars is given below −
%YAML 1.1 --- !!map { ? !!str "simple key" : !!map { ? !!str "also simple" : !!str "value", ? !!str "not a simple key" : !!str "any value" } }
The generated output of block scalar headers is shown below −
{ "simple key": { "not a simple key": "any value", "also simple": "value" } }
Document Marker Scalar Content
All characters in this example are considered as content, including the inner space characters.
%YAML 1.1 --- !!map { ? !!str "---" : !!str "foo", ? !!str "...", : !!str "bar" } %YAML 1.1 --- !!seq [ !!str "---", !!str "...", !!map { ? !!str "---" : !!str "..." } ]
The plain pne breaks are represented with the example given below −
%YAML 1.1 --- !!str "as space trimmed specificL none"
The corresponding JSON output for the same is mentioned below −
"as space trimmed specificu2028 none"Advertisements