How To Import a JSON File Into n8n

Working with data in JSON format is one of the most common tasks in modern automation workflows. Whether you're fetching it from an API, parsing a local file, or working with complex objects, understanding how to import JSON files into n8n can save you a lot of time. If you’re wondering how to import JSON file in n8n, this step-by-step guide will walk you through two popular methods, including real-world use cases and best practices.

Why Import JSON Files into n8n?

JSON (JavaScript Object Notation) is a lightweight data-interchange format that's easy to read and write for humans and machines alike. In n8n, you might import a JSON file to:

  • Populate a database with structured records
  • Send structured data to an API endpoint
  • Trigger conditional workflows based on complex configurations
  • Use static data as a source for testing automation pipelines

Let’s explore how to bring JSON into your workflow effectively.

Method 1: Upload and Import a Local JSON File

Step 1: Prepare Your JSON File

Make sure your .json file is correctly formatted. A single object or an array of objects with key-value pairs works perfectly. Here's an example snippet:

[
  {
    "name": "Alice",
    "email": "alice@example.com",
    "role": "admin"
  },
  {
    "name": "Bob",
    "email": "bob@example.com",
    "role": "editor"
  }
]

Avoid trailing commas and ensure quotation marks are used properly.

Step 2: Use the ‘Read Binary File’ Node

  1. In your n8n workflow editor, add a ‘Read Binary File’ node.
  2. In the ‘File Path’ field, enter the path to your local file. For self-hosted users, this would be a server-accessible path like /home/user/data/users.json. If you're running n8n in Docker, ensure the volume contains your file.
  3. Set the ‘Binary Property’ to something like data.

Step 3: Convert Binary to JSON

Now add a ‘Move Binary Data’ node:

  • Set 'Set All Data as JSON' to true
  • Enter the same binary property name (e.g., data)

This converts the file into a regular JSON object or array for further processing.

Step 4: Parse JSON and Use It

To split or manipulate the data:

  1. Add the ‘SplitInBatches’ node or ‘Set’ node depending on output logic.
  2. If you want each object processed in a loop, link a ‘SplitInBatches’ and follow with an action (email, API, etc.).

This method is highly efficient for processing static data or test configurations.

Use Case: Importing User Data

You could upload a list of new users via JSON and use n8n to send them welcome emails or add them to a CRM like HubSpot.

Method 2: Fetch JSON from a Remote URL or API

For workflows that need dynamic JSON data, you can pull it directly from a URL.

Step 1: Add an HTTP Request Node

  1. Use the ‘HTTP Request’ node.
  2. Set the Method to GET or POST depending on the source.
  3. Paste the URL that serves the JSON file, such as https://example.com/data.json

Step 2: Configure the Output

  • In the node’s settings, set Response Format to JSON
  • n8n will automatically parse and output the results in a clean structure

Now you’ve got your data ready to be looped through, filtered, or transformed.

Use Case: API Integration

Say you’re working with a product catalog served as JSON via an API. You can pull the data daily and send updates to a Shopify store using n8n's Shopify integration.

Troubleshooting Tips When Importing JSON Files

Even a small syntax error in the file can break your workflow. Here are common issues:

Issue Possible Fix
Invalid JSON format Use tools like https://jsonlint.com to validate the file
File not found Double-check the file path and Docker volume mount points
Unexpected node output Use a ‘Set’ or ‘Function’ node to inspect and debug output

For more challenges you might face, see our list of common n8n issues and how to troubleshoot them.

Tips for Better JSON Imports in n8n

  • Use Function node for deep manipulation if the structure is nested
  • Add a ‘Set’ node immediately after parsing for easier debugging
  • Use Item Lists in nodes like SplitInBatches and Merge for working with arrays
  • Always validate your JSON before uploading or using it in workflows

Example: Automating Welcome Emails from a JSON File

Here's a simple JSON automation flow:

  1. Upload JSON with user info
  2. Parse and Split the data
  3. Use ‘Send Email’ node for each user (Gmail, SMTP, Outlook, etc.)

This makes it easy to onboard a batch of users efficiently using automation—even for non-technical teams.

When to Use Each Method

Need Method to Use
Static file on your machine Read Binary File
Fetching from external APIs HTTP Request
Controlled test dataset Upload JSON locally
Real-time data pipeline integrations Remote JSON via URL

Choose your approach based on where your data originates.

If you're just getting started with automation and want to use n8n for free, you can follow our guide to setting up n8n without paying a dime and run these examples locally.

FAQ

How do I import a JSON file in n8n?

You can import a JSON file using the ‘Read Binary File’ node for local files or use the ‘HTTP Request’ node to fetch it from a URL. Then use a ‘Move Binary Data’ node to convert it into usable JSON.

Can n8n parse large JSON files?

Yes, n8n can handle large JSON files, but it's best to use batch nodes like ‘SplitInBatches’ to process each object incrementally and avoid memory issues.

What format should my JSON file be in?

Your file should be valid JSON: either a single object {} or an array [{},{},...]. Make sure there are no trailing commas or malformed structures.

Can I import JSON from Google Drive or other cloud platforms?

Yes, you can connect services like Google Drive using n8n integrations and then pull the file using its API. See our guide on connecting Google apps with n8n.

What happens if my JSON file contains nested arrays or objects?

n8n supports nested objects, but you may need to use the 'Function' or 'Set' node to extract or restructure the data for easier processing in your workflow.

Importing JSON into n8n workflows unlocks vast potential for building scalable, data-driven automations. With just a few simple steps, you can power workflows ranging from basic task automation to complex, AI-enhanced systems.

★★★★★
50+ fixes, templates & explanations
Stuck with n8n errors?
Node-by-node breakdown.
Copy-paste templates.
Beginner friendly.
Get the n8n Beginners Guide
Built by AgentForEverything.com
Comments
Join the Discussion and Share Your Opinion
Add a Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Newsletter
Get The Latest Agent Templates & Guides, Straight To Your Inbox.
Join the #1 AI Automation newsletter.