This example workflow demonstrates how to convert a JSON object into a base64-encoded string using n8n’s built-in file processing capabilities. This is a common requirement when working with APIs, webhooks, or SaaS integrations that expect payloads to be base64-encoded.
Tip: The three green-highlighted nodes (Stringify → Convert to File → Extract from File) can be wrapped in a Subworkflow to create a reusable Base64 encoder in your own projects.
Manual Trigger
Start the workflow using the Manual Execution node. This is useful for testing and development.
Create JSON Data
The Create Json Data node uses raw mode to construct a sample object with all major JSON types: strings, numbers, booleans, nulls, arrays, nested objects, etc.
Convert to String
The Convert to String node uses the expression ={{ JSON.stringify($json) }} to flatten the object into a single string field named json_text.
Convert to File
The Convert to File node takes the json_text value and saves it to a UTF-8 encoded binary file in the property encoded_text.
Extract from File
This node takes the binary file and extracts its contents as a base64-encoded string. The result is saved in the base64_text field.
Create Json Data node with your own payload structure.base64_text output field to post to APIs, store in databases, or include in webhook responses.