
- YAML Tutorial
- YAML - Home
- YAML – Introduction
- YAML – Basics
- YAML – Indentation and Separation
- YAML – Comments
- YAML – Collections and Structures
- YAML – Scalars and Tags
- YAML – Full Length Example
- YAML – Processes
- YAML – Information Models
- YAML – Syntax Characters
- YAML – Syntax Primitives
- YAML – Character Streams
- YAML – Node Properties
- YAML – Block Scalar Header
- YAML – Flow Styles
- YAML – Block Styles
- YAML – Sequence Styles
- YAML – Flow Mappings
- YAML – Block Sequences
- YAML – Failsafe Schema
- YAML – JSON Schema
- YAML Useful Resources
- YAML - Quick Guide
- YAML - Useful Resources
- YAML - Discussion
YAML - Flow Mappings
Flow mappings in YAML represent the unordered collection of key value pairs. They are also called as mapping node. Note that keys should be maintained unique. If there is a duplication of keys in flow mapping structure, it will generate an error. The key order is generated in serialization tree.
Example
An example of flow mapping structure is shown below −
%YAML 1.1 paper: uuid: 8a8cbf60-e067-11e3-8b68-0800200c9a66 name: On formally undecidable propositions of Principia Mathematica and related systems I. author: Kurt Gödel. tags: - tag: uuid: 98fb0d90-e067-11e3-8b68-0800200c9a66 name: Mathematics - tag: uuid: 3f25f680-e068-11e3-8b68-0800200c9a66 name: Logic
The output of mapped sequence (unordered list) in JSON format is as shown below −
{ "paper": { "uuid": "8a8cbf60-e067-11e3-8b68-0800200c9a66", "name": "On formally undecidable propositions of Principia Mathematica and related systems I.", "author": "Kurt Gödel." }, "tags": [ { "tag": { "uuid": "98fb0d90-e067-11e3-8b68-0800200c9a66", "name": "Mathematics" } }, { "tag": { "uuid": "3f25f680-e068-11e3-8b68-0800200c9a66", "name": "Logic" } } ] }
If you observe this output as shown above, it is observed that the key names are maintained unique in YAML mapping structure.
Advertisements