Actions13
Overview
This node provides multiple operations related to the HumanFirst API, including managing playbooks, prompts, pipelines, and importing data. Specifically for the "Convert JSON to CSV" operation, it takes incoming JSON data (either all input items or a nested array within them) and converts it into a flattened CSV format. This is useful when you want to transform structured JSON data into CSV for easier viewing, exporting, or integration with other systems that consume CSV.
Common scenarios:
- Converting complex JSON responses from APIs into CSV files for reporting.
- Flattening nested JSON arrays inside incoming data to CSV for spreadsheet import.
- Preparing JSON data for downstream nodes that require CSV input.
Example:
If your input JSON contains an array of objects under a key like "sentences", you can specify "sentences" as the JSON Array Field. The node will extract that array, flatten each object’s properties into columns, and output a CSV file representing that data.
Properties
| Name | Meaning |
|---|---|
| JSON Array Field | If your data is inside a nested array, enter its key here (e.g. "sentences"). Leave blank to convert all incoming items. |
Output
The node outputs a single item containing:
- json.columnIndices: An object mapping CSV column names to their zero-based index positions.
- binary.csv: A binary property containing the CSV file data encoded in base64, with:
data: Base64-encoded CSV content.fileName: Always"data.csv".mimeType:"text/csv".
The CSV includes a header row with all unique keys found across the flattened JSON objects, sorted alphabetically. Each subsequent row corresponds to one flattened JSON object, with values properly escaped if they contain commas, quotes, or newlines.
Dependencies
- Requires an active connection to the HumanFirst API via an API key credential configured in n8n.
- Uses built-in n8n helper methods for HTTP requests and error handling.
- No additional external libraries are required for the JSON to CSV conversion itself.
Troubleshooting
Empty or malformed JSON Array Field:
If the specified JSON Array Field does not exist or is not an array, the node will fallback to converting all input items. Ensure the field path is correct and points to an array.Invalid JSON input:
If input items do not contain valid JSON objects, the output CSV may be empty or incomplete.Large datasets:
Very large JSON arrays may cause performance issues or timeouts. Consider filtering or paginating data before conversion.Binary data missing:
For other operations (not JSON to CSV), if expected binary data is missing, the node throws errors indicating which binary property was not found.
Links and References
- HumanFirst API Documentation (general reference for API operations)
- n8n Expressions and Data Handling
- CSV Format Specification
If you need details on other operations or resources, please let me know!