AutomationFlowsGeneral › Convert JSON Objects to Base64 Strings with File Processing

Convert JSON Objects to Base64 Strings with File Processing

ByWyeth @wyeth on n8n.io

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.

Event trigger★★★★☆ complexity9 nodes
General Trigger: Event Nodes: 9 Complexity: ★★★★☆ Added:

This workflow corresponds to n8n.io template #6008 — we link there as the canonical source.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "Templates_Base64_Encode",
  "nodes": [
    {
      "id": "923f05ea-cd34-4116-8c1d-83a51fe0080c",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -580,
        -140
      ],
      "parameters": {
        "color": 7,
        "width": 480,
        "height": 320,
        "content": "## Create Example JSON data\n"
      },
      "typeVersion": 1
    },
    {
      "id": "d1a367bc-f372-40ef-ac8a-abc6326a6b8c",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        -140
      ],
      "parameters": {
        "color": 4,
        "width": 440,
        "height": 320,
        "content": "## Stringify JSON and Save to Binary\n"
      },
      "typeVersion": 1
    },
    {
      "id": "960842f1-5017-415f-80b6-4e21d2c0c51d",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        380,
        -140
      ],
      "parameters": {
        "color": 4,
        "width": 360,
        "height": 320,
        "content": "## Convert Binary Data to Base64 Encoded string\n"
      },
      "typeVersion": 1
    },
    {
      "id": "f0b298ab-18f7-414a-ae27-76266830029c",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -580,
        -320
      ],
      "parameters": {
        "color": 7,
        "width": 1320,
        "content": "## Encode JSON to Base64 String\nThis example workflow demonstrates how to convert a JSON object into a base64-encoded string using n8n\u2019s 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.\n\n**Put the 3 nodes in green into a Sub and make a reusable base64 encoder in your projects.**"
      },
      "typeVersion": 1
    },
    {
      "id": "dd1d4e6b-40ee-4d37-97c0-6bc4d1c9d560",
      "name": "Create Json Data",
      "type": "n8n-nodes-base.set",
      "position": [
        -300,
        -20
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "{\n  \"string\": \"Hello, world!\",\n  \"number\": 42,\n  \"float\": 3.14,\n  \"booleanTrue\": true,\n  \"booleanFalse\": false,\n  \"nullValue\": null,\n  \"array\": [1, \"two\", false, null],\n  \"nestedObject\": {\n    \"id\": 1,\n    \"name\": \"Nested\",\n    \"attributes\": {\n      \"active\": true,\n      \"tags\": [\"test\", \"sample\"]\n    }\n  },\n  \"arrayOfObjects\": [\n    { \"type\": \"A\", \"value\": 10 },\n    { \"type\": \"B\", \"value\": 20 }\n  ],\n  \"emptyArray\": [],\n  \"emptyObject\": {}\n}\n"
      },
      "typeVersion": 3.4
    },
    {
      "id": "c25f38bf-72a1-4fe3-89b9-dcf0d1d34e30",
      "name": "Manual Execution",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -520,
        -20
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "dcf01114-59d8-4c25-8ee3-5405bed263f2",
      "name": "Convert JSON to String",
      "type": "n8n-nodes-base.set",
      "position": [
        -20,
        -20
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "75e77a08-177d-46dc-bf82-69348bae9e76",
              "name": "json_text",
              "type": "string",
              "value": "={{ JSON.stringify($json) }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "17547a53-ec81-4050-96fe-f1f73542ce85",
      "name": "Extract Base64 from Binary",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        460,
        -20
      ],
      "parameters": {
        "options": {},
        "operation": "binaryToPropery",
        "destinationKey": "base64_text",
        "binaryPropertyName": "encoded_text"
      },
      "typeVersion": 1
    },
    {
      "id": "dd01f82c-2abb-48ff-acbe-0584721225b0",
      "name": "Convert String to Binary",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        180,
        -20
      ],
      "parameters": {
        "options": {
          "encoding": "utf8"
        },
        "operation": "toText",
        "sourceProperty": "json_text",
        "binaryPropertyName": "encoded_text"
      },
      "typeVersion": 1.1
    }
  ],
  "settings": {
    "executionOrder": "v1"
  },
  "connections": {
    "Create Json Data": {
      "main": [
        [
          {
            "node": "Convert JSON to String",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Manual Execution": {
      "main": [
        [
          {
            "node": "Create Json Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert JSON to String": {
      "main": [
        [
          {
            "node": "Convert String to Binary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert String to Binary": {
      "main": [
        [
          {
            "node": "Extract Base64 from Binary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Base64 from Binary": {
      "main": [
        []
      ]
    }
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

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.

Source: https://n8n.io/workflows/6008/ — original creator credit. Request a take-down →

More General workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

General

Batch-convert CAD/BIM files to analysis-ready XLSX and optional DAE with automatic verification and a clean HTML report. Runs locally via and PowerShell on Windows.

Execute Command, Write Binary File
General

Community Node Disclaimer: This workflow uses KlickTipp community nodes.

N8N Nodes Klicktipp, Google Calendar Trigger, Google Calendar
General

Sync your Linear issues to Todoist automatically with this n8n workflow. When an issue is created, updated, or completed in Linear, a corresponding task is created, updated, or closed in Todoist. Trig

Todoist, Linear Trigger, Linear
General

Back up n8n workflows to Google Drive automatically This workflow provides a robust solution for backing up your n8n workflows to Google Drive. It is designed to handle backups for multiple n8n instan

Execute Workflow Trigger, n8n, Google Drive
General

This n8n workflow provides automated rsync backup capabilities between servers using password authentication. It automatically installs required dependencies, performs the backup operation from a sour

Execute Command