YAML icon

YAML

Convert data to YAML or from YAML

Convert to YAML

AI-generated

Summary

Convert JSON data from input items into YAML-formatted binary files, either aggregating all items into one file or creating a separate file for each item, with configurable encoding and formatting options.

Inputs

  • Mode — Choose whether to convert all input items into a single YAML file ('All Items to One File') or convert each item into a separate YAML file ('Each Item to Separate File'). Defaults to 'All Items to One File'.
  • Put Output File in Field (required) — Name of the binary field in the output items where the YAML file data will be stored. Defaults to 'data'.
  • Options — Additional settings for the YAML output including:
  • Add Byte Order Mark (BOM): Whether to add a BOM marker at the start of the file (effective only with certain encodings).
  • Format: Whether to format the YAML for easier reading.
  • Encoding: The character set used to encode the YAML file, defaulting to utf8.
  • File Name: Optional file name for the output YAML file.

Output shape

A list of output items, each containing a binary property (named as specified) holding the YAML file data. In 'All Items to One File' mode, the output is a single item with the combined YAML content of all input items; in 'Each Item to Separate File' mode, each input item produces one output item with its own YAML file.

The output items contain empty JSON data and the binary data under the specified field name. Errors during conversion for individual items result in output items with an 'error' message in JSON if 'Continue On Fail' is enabled; otherwise, execution stops with an error. The MIME type of output files is set to 'application/yaml'.

Examples

Example 1: Convert multiple input JSON items into a single YAML file stored in the 'data' binary field with UTF-8 encoding and formatted YAML.

Mode set to 'All Items to One File', Put Output File in Field set to 'data', Options with Encoding 'utf8' and Format true.

Example 2: Convert each input JSON item into separate YAML files stored individually in the 'yamlFile' binary field, with a specified file name.

Mode set to 'Each Item to Separate File', Put Output File in Field set to 'yamlFile', Options with File Name 'item.yaml' and Encoding as desired.

Links

Discussion