YAML icon

YAML

Parse YAML

Overview

This node parses or stringifies YAML data. It is useful when you need to convert YAML strings into JSON objects for further processing in your workflow, or convert JSON data back into YAML format. Common scenarios include integrating with systems that use YAML configuration files or APIs that accept YAML payloads.

For example:

  • Parsing a YAML configuration file content into JSON to manipulate or extract specific values.
  • Converting JSON data into a YAML string to send to an API expecting YAML input.

Properties

Name Meaning
Operation Choose between "Parse" (convert YAML string to JSON) or "Stringify" (convert JSON to YAML string).
YAML / Value For "Parse": the YAML string to parse. For "Stringify": the JSON value to convert to YAML.
Property Name The name of the property in the output JSON where the parsed or stringified result will be stored. Default is "data".

Output

The node outputs an array of items, each containing:

  • json: The original input JSON merged with a new property (named as specified by "Property Name") holding the parsed YAML object (if operation is Parse) or the YAML string (if operation is Stringify).
  • binary (optional): If the input item contains binary data, it is preserved and passed through unchanged.

Example output JSON structure after parsing:

{
  "propertyName": {
    /* Parsed YAML as JSON object */
  },
  /* other original properties */
}

If stringifying, the property will contain a YAML string instead.

Dependencies

  • Uses the external yaml library for parsing and stringifying YAML.
  • Uses lodash.set to set nested properties dynamically in the output JSON.
  • Requires no special credentials or environment variables.

Troubleshooting

  • Invalid YAML syntax: If the YAML string is malformed, the node will throw an error unless "Continue On Fail" is enabled. Verify the YAML syntax before parsing.
  • Incorrect property name: Ensure the "Property Name" does not conflict with existing keys if you want to avoid overwriting data.
  • Empty input: Providing an empty YAML string to parse will result in an empty object or null; ensure input is valid.
  • Data type mismatch on stringify: When stringifying, the input must be a valid JSON value; otherwise, errors may occur.

Links and References

Discussion