YAML icon

YAML

Convert data to YAML or from YAML

Overview

The node named "YAML" provides functionality to work with YAML data within n8n workflows. Specifically, the "Extract From YAML" operation allows users to parse and extract structured data from a YAML file or content provided as binary input. This is useful when you have YAML files or streams and want to convert them into JSON-like objects for further processing in your workflow.

Common scenarios include:

  • Parsing configuration files stored in YAML format.
  • Extracting data from YAML-based API responses or files.
  • Converting YAML documents into JSON objects for use in other nodes.

For example, if you receive a YAML file containing user information, this node can extract that data into JSON fields, making it easier to manipulate or send to other services.

Properties

Name Meaning
Input Binary Field The name of the input binary field that contains the YAML file data to be processed. For example, if the binary data is under the key "data", specify "data".
Destination Output Field The name of the output field where the extracted data will be stored after parsing the YAML content. For example, "data" or any custom field name.
Options A collection of additional options:
- File Encoding Specifies the encoding of the input file. Defaults to "utf8". Supports many encodings such as ascii, base64, binary, utf16, windows1252, etc.
- Strip BOM (Shown only for certain encodings like utf8) Whether to strip the Byte Order Mark (BOM) from the file. Useful if BOM presence causes issues. Defaults to true.
- Keep Source Determines what parts of the original input item to keep in the output:
• JSON — keep the original JSON data
• Binary — keep the original binary data
• Both — keep both JSON and binary data from the input item

Output

The node outputs an array of items where each item contains a json property. The json property holds the parsed data extracted from the YAML content, placed under the key specified by the "Destination Output Field" property.

If the "Keep Source" option is set, the output items may also retain the original JSON and/or binary data from the input item, allowing downstream nodes to access both the raw and parsed data.

No binary output is generated by this operation itself; it focuses on converting binary YAML data into JSON objects.

Dependencies

  • The node requires the input YAML data to be provided as binary data in the specified input binary field.
  • It supports various text encodings for reading the YAML content correctly.
  • No external API keys or services are required.
  • The node depends on internal YAML parsing libraries bundled with the node's implementation.

Troubleshooting

  • Incorrect encoding errors: If the YAML file is not decoded properly, verify that the "File Encoding" matches the actual encoding of the input file. Mismatched encoding can cause parsing failures or corrupted output.
  • Parsing errors: Malformed YAML content will cause the extraction to fail. Ensure the YAML syntax is valid.
  • Missing binary data: If the specified input binary field does not exist or is empty, the node will not be able to process the data. Confirm the binary field name matches the incoming data.
  • BOM issues: If unexpected characters appear at the start of the output, try toggling the "Strip BOM" option.

Links and References

Discussion