@tiagopigatto/n8n-nodes-json-text-splitter
v0.2.4
Published
N8N node for automatic JSON object chunk splitting
Maintainers
Keywords
Readme
@tiagopigatto/n8n-nodes-json-text-splitter
This is an n8n community node. It lets you split JSON text into JSON-object chunks in your n8n workflows.
n8n is a fair-code licensed workflow automation platform.
Installation
Operations
Compatibility
Usage
Resources
Installation
Follow the installation guide in the n8n community nodes documentation.
Quick Installation:
- Make sure to allow community nodes with
N8N_COMMUNITY_PACKAGES_ENABLED=true - Once logged in to your N8N web UI, go to
/settings/community-nodesand type@tiagopigatto/n8n-nodes-json-text-splitter
Self-hosted: load locally (no registry install)
If you don’t want n8n to install from npm, you can load this node as a local custom extension.
Copy this folder into a directory you will mount into your n8n instance, for example:
<somewhere-on-host>/n8n-custom/@tiagopigatto/n8n-nodes-json-text-splitter/
Put the contents of
json_text_splitter/(this repo folder) inside that package directory.Install the package dependencies inside the container (or bake them into a custom image):
npm install --omit=dev --no-audit --no-fund
Set n8n to load custom extensions from that parent folder (the one containing
@tiagopigatto/...):N8N_CUSTOM_EXTENSIONS=/home/node/.n8n/custom
Restart n8n. The node should appear in the editor as “JSON Text Splitter” (AI → Text Splitters).
Operations
The JSON Text Splitter node provides token-bounded JSON object chunking:
- Object selection: Collect objects from the JSON (recommended: objects inside arrays)
- Token-bounded packing: Packs multiple objects per chunk, keeping each chunk under a token budget (approximate)
- Oversized object splitting: If a single object is too large, it is split into multiple smaller object parts
- Configurable behavior: Decide what to do on invalid JSON or when there are no matches
- Flexible output: Pretty-print JSON and trim whitespace
Compatibility
- Minimum n8n version: Compatible with n8n v1.0+
- Node.js version: Requires Node.js 18.10 or higher
- Dependencies: Uses
@langchain/textsplitters
Usage
Node configuration
- Object Selection:
Array Objects(default): objects that appear as elements inside arraysAll Objects: all objects found in the JSON (excluding the root)
- Max Tokens Per Chunk: default
900(approximate) - Chars Per Token (Estimate): default
4(tokens ≈ chars/4) - On Invalid JSON:
error(default),returnOriginal, orempty - On No Matches:
empty(default) orreturnOriginal - Pretty Print JSON: Pretty-print JSON output
- Trim: Trim whitespace on the produced chunks
Example
If your input text is:
{"items":[{"text":"a"},{"text":"b"}]}With the default Array Objects selection, the output chunks will be JSON like:
{"items":[{"path":"/items/0","value":{"text":"a"}},{"path":"/items/1","value":{"text":"b"}}]}
