blog.postman.com Open in urlscan Pro
162.159.130.53  Public Scan

Submitted URL: https://go.postman.com/MDY3LVVNRC05OTEAAAGPs5wrgN7YqALbGLAuJKkNPPVIS8bWjqxvLvNG1vFbI_BSYqX2Uibe268A0toC3aS51c6HbwU=
Effective URL: https://blog.postman.com/what-is-yaml/?utm_source=marketo&utm_medium=email&utm_campaign=newsletter&utm_term=nov_2023&utm_...
Submission Tags: falconsandbox
Submission: On November 28 via api from US — Scanned from DE

Form analysis 2 forms found in the DOM

GET /

<form class="form-inline my-lg-0" method="get" action="/">
  <label htmlfor="search-lc" class="search-label">
    <svg class="nav-search__icon" width="16" height="16" viewBox="0 0 16 16" fill="#6b6b6b" xmlns="http://www.w3.org/2000/svg">
      <path fill-rule="evenodd" clip-rule="evenodd"
        d="M9.87147 9.16437C10.5768 8.30243 11 7.20063 11 6C11 3.23858 8.76142 1 6 1C3.23858 1 1 3.23858 1 6C1 8.76142 3.23858 11 6 11C7.20063 11 8.30243 10.5768 9.16437 9.87147L9.89648 10.6036L9.64648 10.8536L13.5758 14.7829C13.8101 15.0172 14.19 15.0172 14.4243 14.7829L14.7829 14.4243C15.0172 14.19 15.0172 13.8101 14.7829 13.5758L10.8536 9.64648L10.6036 9.89648L9.87147 9.16437ZM6 10C8.20914 10 10 8.20914 10 6C10 3.79086 8.20914 2 6 2C3.79086 2 2 3.79086 2 6C2 8.20914 3.79086 10 6 10Z">
      </path>
    </svg>
  </label>
  <input class="form-control" id="search-lc" type="search" placeholder="Search Postman Blog" aria-label="Search" name="s" autocomplete="off" spellcheck="false" dir="auto" value="">
</form>

POST https://blog.postman.com/wp-comments-post.php?wpe-comment-post=mktgproduction

<form action="https://blog.postman.com/wp-comments-post.php?wpe-comment-post=mktgproduction" method="post" id="commentform" class="comment-form" novalidate="">
  <p class="comment-notes"><span id="email-notes">Your email address will not be published.</span> <span class="required-field-message">Required fields are marked <span class="required">*</span></span></p>
  <p class="comment-form-author"><label for="author">Your name</label><br><input class="form-control" id="author" name="author" aria-required="true"></p>
  <p class="comment-form-email"><label for="author">Your email</label><br><input class="form-control" id="email" name="email"></p>
  <p class="comment-form-comment"><label for="author">Write a public comment</label><textarea class="form-control" id="comment" name="comment" aria-required="true"></textarea></p>
</form>

Text Content

 * Product
   
   GETTING STARTED
   
   What is Postman? Customer Stories Download Postman →
   
   API PLATFORM
   
   Collaborate in Workspaces Organize with Collections Explore the API Client
   Build Postman Flows Work smarter with Postbot Browse API Tools
   
   ENTERPRISE SOLUTIONS
   
   Enterprise Essentials API Test Automation Internal API Management
 * What is Postman? API Repository Tools Governance Workspaces Integrations Get
   Started Free →
 * Pricing
 * Enterprise
 * Resources and Support
   
   LEARNING
   
   Learning Center Docs Postman Academy White Papers Breaking Changes Show
   Templates Tutorials Webinars State of the API Report Guide to API-First
   
   COMMUNITY AND EVENTS
   
   Blog Community Postman Supernovas Student Program Events Postman Swag
   
   SUPPORT
   
   Support Center Reseller Support Postman Status Release Notes Contact Us
 * Public API Network

Contact Sales Sign In Sign Up for Free Launch Postman
Blog

 * Learning Center
   
   Learn about how to get started using Postman, and read more in the product
   docs.

 * Labs
   
   Flows, gRPC, WebSockets! Learn about the latest cutting-edge features brewing
   in Postman Labs.

 * Open Technologies
   
   Invest in the knowledge, specifications, standards, tooling, data, people,
   and organizations that define the next 50 years of the API economy.

 * Collection Format
   
   Understand the specification behind Postman Collections. Check out the docs
   and support resources!

 * Blog
   
   The Postman blog is your hub for API resources, news, and community. Learn
   about the Postman API Platform and much more.


 * AI
 * API-First
 * Product Updates
 * Company News
 * Tutorials




WHAT IS YAML?

Gbadebo Bello
November 6, 2023· 5 mins

YAML, which stands for “YAML Ain’t Markup Language” or “Yet Another Markup
Language,” is a human and machine-readable data serialization format. It is
often used for configuration files and data exchange between programming
languages with different data structures.

In this article, we’ll walk through the syntax of YAML and discuss some of its
key benefits. Then, we’ll explain the difference between YAML and JSON and
explore the reasons you might choose one over the other. We’ll also review some
common YAML use cases, as well as some best practices for working with it.


WHAT IS THE STRUCTURE OF YAML?

YAML uses indentation and key-value pairs to present data, making it a
human-readable and straightforward data serialization format. YAML documents can
represent various data structures, including scalars (strings, numbers,
booleans), lists (arrays), dictionaries (maps), and nested structures. Let’s
take a look at the YAML document below.

# YAML example with different data structures

person:
    name: John Doe
    age: 30

hobbies:
    - Reading
    - Hiking
    - Cooking

# This is a comment in YAML
favorite_number: 42
is_student: true

description: |
    This is a multi-line
    description in YAML.

# End of YAML example


Here is a breakdown of the basic components and structure of the above YAML
document:

 * Indentation: YAML uses indentation to indicate the nesting and hierarchy of
   data. Spaces or tabs are used for indentation, and the number of spaces/tabs
   is consistent within a YAML document (e.g., two or four spaces per level).
   Consistency is crucial because YAML relies on indentation for structure. In
   the above example, the data is indented using four spaces.
 * Key-value pairs: In YAML, key-value pairs are used to represent data. The key
   and value are separated by a colon. In our example, “name” is a key, and
   “John Doe” is its value.
 * Lists (arrays): YAML supports lists or arrays, which are represented using
   hyphens (“-“). Items in a list are indented with the same number of spaces or
   tabs to indicate they are part of the list. The hobbies list in the above
   example must include a minimum of one item, but beyond that, it can have as
   many items as necessary.
 * Dictionaries (maps): YAML allows you to create dictionaries or maps, which
   are collections of key-value pairs. Think of them as dictionaries in Python
   or objects in JSON. The person dictionary in our example above has two
   properties: name and age.
 * Scalars: Scalars in YAML are individual values like strings, numbers,
   booleans, and null. Scalars do not require special syntax; you can write them
   directly. For instance, favorite_number and is_student in our example are
   both scalars. You can also represent multiline strings as scalars in YAML
   without the need for any special syntax, as shown in the description property
   above.
 * Comments: YAML supports comments, which are preceded by the “#” symbol.
   Comments provide explanatory notes within the YAML document.


WHAT IS THE DIFFERENCE BETWEEN YAML AND JSON?

YAML files are stored using the .yaml or .yml extension and are designed to be
highly portable and human-readable. YAML is a superset of JSON, which means that
any valid JSON document is a valid YAML document.

While YAML and JSON serve similar purposes, they have distinct syntax,
semantics, and use cases. Some of their differences are highlighted below.

Syntax differences:

 * YAML: YAML uses indentation in its data structure, relying on spaces or tabs
   to indicate nesting. It also uses colons to denote key-value pairs and dashes
   to represent items in lists.
 * JSON: JSON uses a more explicit syntax with curly braces to define objects
   and square brackets to define arrays. It also uses double quotes for string
   keys and values.

Readability:

 * YAML: YAML is often considered more human-readable due to its use of
   indentation and minimal punctuation. It closely resembles the way humans
   naturally structure lists and data.
 * JSON: JSON is less readable for humans due to its heavier use of punctuation
   and explicit syntax. While it’s still relatively straightforward, it’s not as
   visually intuitive as YAML.

Data types:

 * YAML: YAML has native support for more complex data types, including dates
   and binary data. It also allows for multi-line strings.
 * JSON: JSON primarily supports basic data types such as strings, numbers,
   booleans, arrays, and objects. It doesn’t have native support for dates or
   binary data.

Usage

 * YAML: YAML is often preferred for configuration files, particularly in DevOps
   and infrastructure-as-code (IaC) scenarios. It’s also used in data
   serialization and exchange, where human readability is a priority.
 * JSON: JSON has native support for many programming languages, which makes it
   a great fit for data interchange between web services. It is also the
   preferred format for transmitting data in APIs and web applications.


WHAT CAN YAML BE USED FOR?

YAML has a wide range of use cases across various domains. Its human-readable
and machine-friendly structure makes it a popular choice for:

 * Configuration files: YAML is commonly used for configuration files in
   software applications. It allows developers to define settings, parameters,
   and options in a human-readable format. It is particularly very popular and
   widely used amongst DevOps and Cloud Native developers.
 * API and web services: YAML is used to write API definitions for popular API
   specifications, such as OpenAPI and AsyncAPI. These specifications are used
   to describe and document API services.
 * Metadata: YAML can be used to store and organize metadata and content
   structure. Documentation generators, package management tools, LaTex files,
   and Markdown documents use YAML to describe metadata information.
 * Data serialization: YAML is used for data serialization, especially in
   situations where human readability is essential. JSON  and other data formats
   can be converted to and from YAML.


WHAT ARE SOME BEST PRACTICES FOR WORKING WITH YAML?

When working with YAML, it’s important to adhere to the following best practices
to ensure data integrity, readability, and compatibility across different
systems:

 * Consistency: Be consistent in your semantics. For instance, use a consistent
   number of spaces (commonly two or four spaces) for indentation throughout
   your YAML file, maintain consistent naming conventions, and uniformly use
   single or double quotes for strings to avoid ambiguity. Consistency ensures
   that the document structure is clear and easily understood.
 * Use spaces for indentation: While YAML allows both spaces and tabs for
   indentation, it’s generally recommended to use spaces to avoid potential
   cross-platform issues.
 * Validation: Use YAML linters or validators to catch syntax errors and
   potential issues in your YAML files. Popular tools like yamllint and IDE
   extensions can help with this.
 * Security: Be cautious when using YAML for configuration, especially in
   situations where the YAML is auto-generated and contains user input data.
   Ensure that confidential credentials are not stored in plain text, and
   implement proper input validation and security measures to prevent potential
   exploits.
 * Modularization: Break large YAML files into smaller, modular files when
   possible in order to improve maintainability and reusability.

+13
Tags: Data format Tutorials YAML

Gbadebo Bello

 * 
 * 
 * 

Gbadebo Bello is a developer relations engineer at Postman. View all posts by
Gbadebo Bello.

What do you think about this topic? Tell us in a comment below.




COMMENT CANCEL REPLY

Your email address will not be published. Required fields are marked *

Your name


Your email


Write a public comment





Δ

This site uses Akismet to reduce spam. Learn how your comment data is processed.


YOU MIGHT ALSO LIKE


OPENAPI VS. SWAGGER

The Postman Team· 7 mins

Swagger 2 and OpenAPI 3 are API specifications that describe RESTful HTTP APIs
in YAML- or JSON-based documents that can be read…

Read more →


INTRODUCING POSTMAN ASSETS SCAFFOLDING TO AUTOMATICALLY BUILD POSTMAN ASSETS

The Postman Team· 5 mins

Today, we’re announcing a new tool known as Postman Assets Scaffolding (PAS),
which is available in the Postman Public Workspace. This exciting…

Read more →


WHAT IS OPENAPI?

The Postman Team· 7 mins

OpenAPI, formerly known as Swagger, is an interoperable, machine-readable, and
human-friendly specification format that is used to define HTTP APIs. It relies…

Read more →


POSTMAN NAMED BEST API PLATFORM

Postman is the #1 place where developers come to work with APIs. See why we’re
top-ranked in G2’s first-ever evaluation of API Platforms.

Read more →

© 2023 Postman, Inc.


PRODUCT

 * What is Postman?
 * API Repository
 * Tools
 * Governance
 * Workspaces
 * Integrations
 * Enterprise
 * Plans and pricing
 * Download the app
 * Support Center


COMPANY

 * About
 * Careers and culture
 * Press and media
 * Contact us
 * Partner program


LEGAL AND SECURITY

 * Terms of Service
 * Trust and Safety
 * Privacy policy
 * Cookie notice
 * Privacy choices


API CATEGORIES

 * App Security
 * Payments
 * Financial Services
 * DevOps
 * Developer Productivity
 * Data Analytics
 * Communication
 * Artifical Intelligence


SOCIAL

 * Twitter
 * LinkedIn
 * GitHub
 * YouTube
 * Asset 2
   Twitch

We use cookies on your device to enhance your navigation experience, analyze
usage to improve our site, and customize our marketing efforts. You can learn
more about cookies in ourCookie Notice.
Reject All Cookies Accept All Cookies
Manage Cookies




PRIVACY PREFERENCE CENTER

When you visit any website, it may store or retrieve information on your
browser, mostly in the form of cookies. This information might be about you,
your preferences or your device and is mostly used to make the site work as you
expect it to. The information does not usually directly identify you, but it can
give you a more personalized web experience. Because we respect your right to
privacy, you can choose not to allow some types of cookies. Click on the
different category headings to find out more and change our default settings.
However, blocking some types of cookies may impact your experience of the site
and the services we are able to offer.
More information
Allow All


MANAGE CONSENT PREFERENCES

STRICTLY NECESSARY COOKIES

Always Active

These cookies are necessary for the website to function and cannot be switched
off in our systems. They are usually only set in response to actions made by you
which amount to a request for services, such as setting your privacy
preferences, logging in or filling in forms. You can set your browser to block
or alert you about these cookies, but some parts of the site will not then work.

Cookies Details‎

FUNCTIONAL COOKIES

Functional Cookies

These cookies enable the website to provide enhanced functionality and
personalisation. They may be set by us or by third party providers whose
services we have added to our pages. If you do not allow these cookies then some
or all of these services may not function properly.

Cookies Details‎

TARGETING COOKIES

Targeting Cookies

These cookies may be set through our site by our advertising partners. They may
be used by those companies to build a profile of your interests and show you
relevant adverts on other sites. If you do not allow these cookies, you will
experience less targeted advertising.

Cookies Details‎

PERFORMANCE COOKIES

Performance Cookies

These cookies allow us to count visits and traffic sources so we can measure and
improve the performance of our site. They help us to know which pages are the
most and least popular and see how visitors move around the site. All
information these cookies collect is aggregated and therefore anonymous. If you
do not allow these cookies we will not know when you have visited our site, and
will not be able to monitor its performance.

Cookies Details‎
Back Button


COOKIE LIST



Search Icon
Filter Icon

Clear
checkbox label label
Apply Cancel
Consent Leg.Interest
checkbox label label
checkbox label label
checkbox label label

Confirm My Choices