Convert Nested Database API Responses to Flat Arrays - n8n Workflow

Use this n8n workflow to transform complex, nested JSON objects (like those from FileMaker Data API) into a flat array of records using the Item Lists and Function n8n nodes.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Users integrating legacy database systems (like FileMaker) with modern applications.

  • Data engineers and automation specialists needing to clean and normalize deeply nested JSON outputs.

  • Developers looking for robust n8n templates for data manipulation without complex external scripts.

  • Anyone wanting to learn how to efficiently use the Function and Item Lists n8n node combination.

Overview

When interacting with some complex APIs, such as the FileMaker Data API, the returned data is often nested beneath several layers of metadata (e.g., response.data[].fieldData). This deeply nested structure can be challenging for subsequent applications or standard n8n nodes to process directly. This n8n workflow provides a clear, three-step solution to effectively un-nest and flatten this data. By using a sequence of core n8n node types, this workflow ensures that each individual record (fieldData) is extracted and made available as a separate, clean item for downstream processing, dramatically simplifying data integration tasks within your overall n8n automation pipeline. This is a highly reusable pattern among advanced n8n templates.

How it Works

This sample n8n workflow demonstrates a typical data cleansing and flattening process. It does not use an external n8n trigger but starts with simulated data to illustrate the core logic:


  1. Simulated API Response: The process begins with the 'FileMaker Data API Contacts' function node, which holds a mocked JSON response mimicking the structure of a FileMaker Data API read request. This data contains metadata and a nested array of contact records.

  2. Extract and Split Array: The 'FileMaker response.data' item lists n8n node targets the main data array (response.data) within the complex JSON structure. It splits this single incoming item into multiple items, where each new item represents one record object (which still contains the nested fieldData).

  3. Flatten Records: The final 'Return item.fieldData' function item n8n node processes each item generated in the previous step. It uses a simple JavaScript snippet (return item.fieldData;) to extract only the contents of the fieldData object, transforming the complex, nested API response into a clean, flat list of usable contact records. This clean output is ready for use in any subsequent n8n node, such as Google Sheets, a CRM, or a database insertion.

Installation Guide

To utilize this valuable n8n workflow, follow these steps:


  1. Import the n8n Workflow: Copy the provided JSON data. Navigate to your n8n instance, click 'New' (or 'Workflows'), and then select 'Import from JSON'. Paste the workflow code.

  2. Initial Review: As this n8n workflow uses sample data within the 'FileMaker Data API Contacts' function node, no immediate external credentials are required.

  3. Adapt for Live Use: To integrate this into a live n8n pipeline, you will typically replace the initial 'FileMaker Data API Contacts' Function node with an HTTP Request node configured to call your actual FileMaker Data API endpoint. You must ensure the response data path used in the 'FileMaker response.data' n8n node is updated if your live API response structure differs slightly from the mock data used in this n8n template.

Node Details

FileMaker Data API Contacts (Function n8n node):
Function: Serves as the starting point, simulating the nested JSON response payload typically received from a backend system like the FileMaker Data API when retrieving multiple records.
Key Configuration: Contains hardcoded sample JSON data with contacts nested under response.data[].fieldData.

FileMaker response.data (Item Lists n8n node):
Function: Designed to handle the core structural transformation task. It targets the array located at =response.data within the input data.
Key Configuration: Operation set to 'Split Out Items'. The field to split is dynamically referenced using an expression: =response.data.

Return item.fieldData (Function Item n8n node):
Function: The final refining step. This dedicated n8n node extracts the final, flat data structure from each item generated by the Item Lists node.
* Key Configuration: Custom Javascript code is simple and targeted: return item.fieldData;. This ensures only the clean contact record data passes to the next step of the n8n workflow.

Related n8n Workflows

Free

Nodes: 3 Nodes
Updated: December 26 2025
View all
Created by
Dick
Dick