JSON Text Splitter
AI-generatedSummary
Split JSON text input into smaller chunks by extracting selected objects and dividing them to respect a maximum token size per chunk, optionally including metadata and formatting output as JSON Lines or JSON Arrays.
Inputs
- Object Selection — Choose whether to extract objects from arrays only ('Array Objects') or all objects in the JSON excluding the root ('All Objects').
- Max Tokens Per Chunk (required) — Set the approximate maximum number of tokens allowed per chunk; larger objects are split accordingly.
- Chars Per Token (Estimate) (required) — Define the estimated character-to-token ratio used to calculate chunk sizes.
- Unwrap Key — Specify a key whose object value should be chunked instead of the parent object, or leave empty to disable unwrapping.
- Output Format — Select output format as 'JSON Lines' (one object per line) or 'JSON Array' (array of objects per chunk).
- Include Path Metadata — Enable inclusion of JSON pointer path and part number metadata with each emitted object.
- Skip Large Parent Objects — Enable skipping of large parent objects containing arrays to chunk only the nested array objects.
- On Invalid JSON — Define behavior when input JSON is invalid: throw an error, return original text, or return empty output.
- On No Matches — Define behavior if no objects matching criteria are found: return empty output or original text.
- Pretty Print JSON — Enable pretty-printing (formatted JSON) for output chunks.
- Trim — Enable trimming of whitespace from each produced chunk.
Output shape
a single string containing the JSON chunks in the selected output format (JSON Lines or JSON Array).
Chunks contain extracted and optionally split JSON objects as specified. If path metadata is enabled, each chunk includes JSON pointer paths and part numbers. Behavior on invalid JSON or no matches follows the configured options.