YAML icon

YAML

Convert data to YAML or from YAML

Overview

This node provides multiple operations to work with YAML data, including converting JSON data to YAML format. Specifically, the "JSON to YAML" operation takes JSON input and converts it into a YAML string. This is useful when you need to transform structured JSON data into a human-readable YAML format for configuration files, documentation, or integration with systems that require YAML input.

Practical examples:

  • Converting API response JSON into YAML for easier editing or sharing.
  • Preparing configuration data in YAML format from JSON sources.
  • Transforming JSON payloads into YAML before sending them to services that accept only YAML.

Properties

Name Meaning
Input Json Field The name of the property in the input item that contains the JSON data to convert.
Destination Output Field The name of the property where the resulting YAML string will be stored in the output.

For example, if "Input Json Field" is set to data, the node expects the JSON data inside the data property of each input item. The converted YAML will then be placed in the property named by "Destination Output Field", e.g., data.

Output

The node outputs items where each item's JSON data includes a new property (as specified by "Destination Output Field") containing the YAML representation of the original JSON data.

  • The output field is a string containing the YAML-formatted data.
  • No binary data output is produced by this operation.

Example output JSON snippet:

{
  "data": "yaml: formatted\nstring: here\n"
}

Dependencies

  • The node relies on internal helper functions imported from bundled modules to perform the JSON to YAML conversion.
  • No external API keys or services are required.
  • No special environment variables or n8n configurations are necessary.

Troubleshooting

  • Invalid JSON input: If the input property does not contain valid JSON data, the conversion will fail. Ensure the input field contains properly structured JSON.
  • Missing input property: If the specified input JSON field does not exist in the incoming data, the node will not find data to convert. Verify the property name matches the input data structure.
  • Output property conflicts: If the destination output field name conflicts with existing properties, it may overwrite important data. Choose a unique output property name to avoid data loss.

Common error messages might indicate parsing failures or missing data fields. To resolve, check the input data format and property names carefully.

Links and References

Discussion