Overview
This node provides functionality to convert data between YAML and JSON formats, as well as other YAML-related operations such as extracting data from YAML, converting JSON to YAML, and setting values within YAML content. Specifically, the "YAML to JSON" operation converts YAML-formatted text into JSON objects, which can then be used in subsequent workflow steps that require JSON input.
Common scenarios for this node include:
- Parsing configuration files or data stored in YAML format to JSON for easier manipulation.
- Integrating systems where one part outputs YAML but downstream processes expect JSON.
- Automating workflows that involve reading YAML files and transforming their contents.
For example, if you have a YAML string representing user settings, this node can convert it into JSON so that other nodes can access individual properties easily.
Properties
| Name | Meaning |
|---|---|
| If your YAML is inside a binary file, use the 'Extract YAML from File' node to convert it to text first | A notice reminding users to extract YAML text from binary files before conversion. |
| Input Yaml Field | Name of the property in the input data that contains the YAML string to convert to JSON. |
Output
The output of the "YAML to JSON" operation is an array of items where each item's json property contains the parsed JSON object converted from the input YAML string. This allows downstream nodes to work with structured JSON data extracted from YAML.
If the input YAML was valid and successfully parsed, the JSON output will reflect the equivalent data structure. If the YAML contained multiple documents or complex structures, these will be represented accordingly in JSON.
The node does not output binary data for this operation.
Dependencies
- No external services or API keys are required.
- The node relies on internal libraries bundled with the node implementation to parse YAML.
- No special environment variables or n8n configurations are necessary beyond standard node setup.
Troubleshooting
- Invalid YAML syntax: If the input YAML is malformed, the node may throw parsing errors. Ensure the YAML string is correctly formatted.
- Empty or missing input field: Make sure the property name specified in "Input Yaml Field" exists in the incoming data and contains valid YAML text.
- Binary input instead of text: If the YAML is inside a binary file, use the recommended "Extract YAML from File" node beforehand to convert it to text.
- Large YAML documents: Very large YAML inputs might cause performance issues or timeouts; consider splitting the input if possible.