YAML

What is it?

YAML is a human-readable data serialization format commonly used for configuration files and data exchange in web development. It is indentation-sensitive and supports mappings (key: value), sequences, scalars, as well as features like anchors/aliases and multiple documents in a single file. YAML is often chosen because it's more concise and readable than comparable formats like JSON, but it requires careful handling of indentation and parsing to avoid errors and security issues. Files typically use the .yaml or .yml extension.

Practical example

A common use in web projects is Docker Compose or CI configuration written in YAML. For example, a simple docker-compose fragment might look like: services:\n web:\n image: node:16\n ports:\n - "3000:3000"\n volumes:\n - ./:/app. This defines a 'web' service using the Node image, exposing port 3000 and mounting the project folder. In teams YAML is useful because developers can quickly scan services, environment variables and mounts without a lot of boilerplate.

Test your knowledge

Which of the following features is a unique capability of YAML compared to JSON?

Ask Lex
Lex knows the context of this term and can give targeted explanations, examples, and extra context.
Tip: Lex replies briefly in the widget. For more detail, go to full screen mode.

Learn our language

Learn these terms from real professionals and take your skills further at KdG MCT.

Study at KdG