Convert YAML to ENV

Turn YAML files into Dotenv. Each top-level key becomes a KEY=value line, with characters a variable name cannot hold turned into underscores, and a top-level list numbers its entries from 0 under items, so the name of the first entry becomes items_0_name.

Converted in an isolated sandbox on our serversDeleted after 24 hours

Drop YAML files on the dialor turn it to pick what to do

Config lines from a YAML file.Each top-level key becomes one KEY=value line in a Dotenv file.

  1. What you get

    One ENV file with a KEY=value line for each top-level key. Characters a variable name cannot hold are turned into underscores in the key.

    Text with spaces or symbols is double-quoted with escapes. A null value leaves the part after the equals sign empty.

  2. Lists and nested data

    Nested objects and lists become quoted JSON text. They stay in one value instead of being split into more keys.

    A top-level list numbers its entries from 0 under items, so the name of the first entry becomes items_0_name. A file with several documents is treated as a list.

  3. What changes or is dropped

    Comments are dropped. Aliases are expanded, so each use of an alias holds the value it points to.

    Values such as yes, on, 0755 and dates stay text and are not turned into booleans, numbers or dates. A merge key (<<) is kept as an ordinary key instead of being merged.

  4. When it stops

    The conversion stops with input_corrupted when the file could not be parsed. It stops with unsupported_elements when the file holds something the target cannot carry, or some inputs cannot become the format the join takes.

    To go the other way, use ENV to YAML.

YAML and ENV.What each format is.

The formats

From · YAML

YAML

YAML configuration and data files.

Extensions
.yaml .yml
MIME type
application/yaml
Kind
Text and data
To · ENV

Dotenv

KEY=value lines that hold environment variables for an app.

Extensions
.env
MIME type
text/x-env
Kind
Text and data

In your code.The same YAML to ENV conversion through the API, for your app or your agent.

terminal
$ cv convert report.yaml report.env
$ cv convert report.yaml report.env

Questions.What people ask about YAML to ENV.

01OF 04

Nested objects and lists become quoted JSON text as the value of their top-level key. They are not split into separate lines.

No. Comments are dropped.

No. Values such as yes, on, 0755 and dates stay text.

The documents become a list. A top-level list numbers its entries from 0 under items.

More conversions.Other ways in and out of YAML and ENV.