Questions tagged [yaml]

Use this tag for questions about the YAML data serialization format only, not for questions about programs (or examples) that happen to have their configuration in a YAML format. Questions about the CSS framework also called YAML should be tagged [yaml-css] instead.

From the Wikipedia article about YAML:

YAML (/ˈjæməl/, rhymes with camel) is a human-readable data serialization language that takes concepts from programming languages such as C, Perl, and Python, and ideas from XML and the data format of electronic mail (RFC 2822). YAML was first proposed by Clark Evans in 2001, who designed it together with Ingy döt Net and Oren Ben-Kiki. It is available for several programming languages.

YAML is a recursive acronym for "YAML Ain't Markup Language". Early in its development, YAML was said to mean "Yet Another Markup Language", but it was then reinterpreted (backronyming the original acronym) to distinguish its purpose as data-oriented, rather than document markup.

Features:

  • Its familiar indented outline and lean appearance make it especially suited for tasks where humans are likely to view or edit data structures, such as configuration files, dumping during debugging, and document headers.
  • Although well-suited for hierarchical data representation, it also has a compact syntax for relational data as well.
  • A major part of its accessibility comes from eschewing the use of enclosures like quotation marks, brackets, braces, and open/close-tags, which can be hard for the human eye to balance in nested hierarchies.

See also

Related tags

15259 questions
297
votes
1 answer

How do I create an empty array in YAML?

array_with_three_elements: - 1 - 2 - 3 empty_array: Is there any way to specify that empty_array: is an array with no elements, such as with []? When I load it into a ruby hash I'd like it to know that it's an array. Thanks
Julian Mann
  • 6,256
  • 5
  • 31
  • 43
296
votes
2 answers

What is the difference between .yaml and .yml extension?

I read them on YAML-wikipedia but not really understood the main difference between them. I saw there are someone using .yaml extension, however, Symfony2 use .yml extension. YAML is a human-readable data serialization format that takes concepts…
lvarayut
  • 13,963
  • 17
  • 63
  • 87
255
votes
2 answers

What is the use of the pipe symbol in YAML?

I am new to yaml, and I have a question about the pipe symbol (|) used for multiple lines. Does YAML have any syntax like the one below? test: |6+ Of the two YAML files below, the first one is working and second is not. I do not know what is…
user2053420
247
votes
3 answers

How do I parse a YAML file in Ruby?

I would like to know how to parse a YAML file with the following contents: --- javascripts: - fo_global: - lazyload-min - holla-min Currently I am trying to parse it this way: @custom_asset_packages_yml =…
alvincrespo
  • 9,224
  • 13
  • 46
  • 60
243
votes
5 answers

What do the &,<<, * mean in this database.yml file?

Up until now I have only used database.yml with each parameter called out explicitly, in the file below it uses some characters I do not understand. What does each line and symbol(&, *, <<) mean? How do I read this file? development: &default …
OpenCoderX
  • 6,180
  • 7
  • 34
  • 61
241
votes
10 answers

Spring Boot YAML configuration for a list of strings

I am trying to load an array of strings from the application.yml file. This is the config: ignore: filenames: - .DS_Store - .hg This is the class fragment: @Value("${ignore.filenames}") private List igonoredFileNames =…
Bahadır Yağan
  • 5,577
  • 3
  • 35
  • 39
228
votes
5 answers

YAML Multi-Line Arrays

In YAML, you can easily create multi-line strings. However, I would like the ability to create a multi-line array (mainly for readibility within config files) using the | character. A YAML array can be represented as: ['key1', 'key2', 'key3']. A…
Jimbo
  • 25,790
  • 15
  • 86
  • 131
215
votes
53 answers

Flutter App stuck at "Running Gradle task 'assembleDebug'... "

When I run the app it get stuck Launching lib\main.dart on Lenovo A319 in debug mode... Running Gradle task 'assembleDebug'... (This is taking an unexpectedly long time.) It never initialize Gradle nor the dependencies
learner
  • 2,191
  • 2
  • 6
  • 10
212
votes
6 answers

How to merge YAML arrays?

I would like to merge arrays in YAML, and load them via ruby - some_stuff: &some_stuff - a - b - c combined_stuff: <<: *some_stuff - d - e - f I'd like to have the combined array as [a,b,c,d,e,f] I receive the error: did not find…
random-forest-cat
  • 33,652
  • 11
  • 120
  • 99
210
votes
10 answers

How to set multiple commands in one yaml file with Kubernetes?

In this official document, it can run command in a yaml config file: https://kubernetes.io/docs/tasks/configure-pod-container/ apiVersion: v1 kind: Pod metadata: name: hello-world spec: # specification of the pod’s contents restartPolicy:…
scho
  • 3,275
  • 6
  • 19
  • 30
209
votes
10 answers

how to reference a YAML "setting" from elsewhere in the same YAML file?

I have the following YAML: paths: patha: /path/to/root/a pathb: /path/to/root/b pathc: /path/to/root/c How can I "normalise" this, by removing /path/to/root/ from the three paths, and have it as its own setting, something like: paths: root:…
Andrew Bullock
  • 36,616
  • 34
  • 155
  • 231
181
votes
4 answers

Does application.yml support environment variables?

I tried using env variables in my application.yml configration like: spring: main: show_banner: false --- spring: profiles: production server: address: $OPENSHIFT_DIY_IP port: $OPENSHIFT_DIY_PORT but the env variables are not…
Marcel Overdijk
  • 11,041
  • 17
  • 71
  • 110
181
votes
2 answers

How can I write data in YAML format in a file?

I need to write the below data to yaml file using Python: {A:a, B:{C:c, D:d, E:e}} i.e., dictionary in a dictionary. How can I achieve this?
user1643521
  • 2,191
  • 3
  • 14
  • 6
174
votes
7 answers

Github Action: Split Long Command into Multiple Lines

I have a Github action command that is really long: name: build on: [push] jobs: build: runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v1 - name: Install Prerequisites run: | …
Bojian Zheng
  • 2,167
  • 3
  • 13
  • 17
163
votes
22 answers

Removing all empty elements from a hash / YAML?

How would I go about removing all empty elements (empty list items) from a nested Hash or YAML file?
Brian Jordan
  • 2,377
  • 3
  • 21
  • 29