Overview
This node provides functionality to either parse or stringify YAML data. Specifically, the "Stringify" operation converts a given string value into its YAML string representation and stores it in a specified property of the output JSON. This is useful when you want to transform plain text or structured data into YAML format for configuration files, data exchange, or integration with systems that consume YAML.
Common scenarios include:
- Preparing data to be saved as a YAML file.
- Converting JSON-like strings into YAML format for APIs or services requiring YAML input.
- Transforming workflow data into a human-readable YAML format for logging or debugging.
Example: You have a JSON object or string and want to convert it into a YAML string stored under a custom property for further processing or export.
Properties
| Name | Meaning |
|---|---|
| Value | The string value that should be converted (stringified) into YAML format. |
| Property Name | The name of the property in the output JSON where the resulting YAML string will be set. |
Output
The node outputs an array of items, each containing a json field. Within this json field, the YAML stringified result is assigned to the property specified by the "Property Name" input. The rest of the original input data is preserved.
If the input item contains binary data, it is passed through unchanged to the output.
Example output structure snippet:
{
"json": {
"data": "yaml_string_here"
},
"binary": { /* if any binary data was present in input */ }
}
Dependencies
- Uses the external
yamllibrary for parsing and stringifying YAML. - Uses
lodashfor safely setting nested properties in the output JSON. - Requires no special credentials or API keys.
- No additional environment variables or n8n configurations are necessary.
Troubleshooting
- Error during stringification: If the input value is not a valid string or contains characters that cause the YAML library to fail, an error may be thrown. Ensure the input "Value" is a proper string.
- Property overwrite: If the specified "Property Name" already exists in the input JSON, it will be overwritten with the YAML string output.
- Continue on Fail: If enabled, the node will continue processing subsequent items even if one fails, returning error details in the output.