Truncate (Free Online Tool)
Reduce oversized payloads by truncating strings, capping arrays, and dropping large blobs
Paste your JSON → Get results instantly (no signup)
→ Truncate oversized values in this data for the "Truncate long strings"
1{2 "name": "Alice",3 "description": "This is a very long descriptio..."4}Love the result?
Use this exact pipeline in your app, backend, or LLM workflow.
No setup needed. Works with curl, Node, Python.
Uses example data. For edited input, copy from the playground.
Works with:
- API responses
- Nested JSON
- Arrays & objects
Example: input → output
{ "name": "Alice", "description": "This is a very long description that goes on and on and should be truncated to a reasonable length for display purposes"}{ "name": "Alice", "description": "This is a very long descriptio..."}Related tools
Advanced usage (optional)
Truncate
v1.0.0Description
Truncate
Reduce oversized data by truncating long strings, capping arrays, and removing large blobs. Useful for creating previews, reducing payload size, and cleaning up data with embedded binary content.
Operations
Truncate Strings
Cut strings longer than a specified character count. Adds "..." suffix to indicate truncation.
Cap Arrays
Keep only the first N items in arrays. Remaining items are either silently removed or replaced with a summary placeholder.
Remove Large Blobs
Detect and remove base64-encoded strings and long single-line values larger than 1KB. Useful for stripping embedded images, binary data, and other large payloads.
Collapse Modes
Remove
Silently cut extra array items. The output array simply has fewer items.
Placeholder
Replace truncated content with a human-readable summary like "[...5 more items]". Makes it clear that data was truncated.
Configuration
| Field | Type | Default | Description |
|---|---|---|---|
| Target Paths | path-picker | [] | Scope operations to specific paths (empty = apply everywhere) |
| Max String Length | number | 0 | Truncate strings beyond this character count (0 = no limit) |
| Max Array Length | number | 0 | Keep only the first N array items (0 = no limit) |
| Remove Large Blobs | boolean | false | Remove base64 strings and long single-line values (>1KB) |
| Collapse Mode | enum | remove | remove (silently cut) or placeholder (replace with summary like "[...5 more items]") |
Use Cases
Preview Generation
- List previews: Cap arrays to 3-5 items for card/tile displays
- Text previews: Truncate long descriptions to 100-200 characters
- Summary views: Create compact previews of large datasets
Payload Optimization
- API responses: Reduce response size by capping arrays and truncating strings
- Storage reduction: Remove base64 images and binary blobs before archiving
- Bandwidth saving: Truncate verbose text fields for mobile clients
Data Cleanup
- Image removal: Strip embedded base64 images from JSON documents
- Binary cleanup: Remove encoded binary data that shouldn't be in text format
- Log trimming: Truncate verbose log messages and stack traces
Configuration
| Name | Type | Default | Description |
|---|---|---|---|
| Target Paths | path-picker | [] | Scope operations to specific paths only (empty = apply everywhere) |
| Max String Length | number | 0 | Truncate strings longer than this many characters (0 = no limit) |
| Max Array Length | number | 0 | Keep only the first N items in arrays (0 = no limit) |
| Remove Large Blobs | boolean | false | Remove base64 strings and long single-line values larger than 1KB |
| Max Depth | number | 0 | Truncate nesting beyond this many levels (0 = no limit) |
| Max Keys | number | 0 | Keep only the first N keys per object (0 = no limit) |
| Collapse Mode | enum | remove | remove: silently cut extra items. placeholder: replace with summary like '[...5 more items]' remove placeholder |
Examples
Truncate oversized values in this data for the "Truncate long strings" example.1{2 "name": "Alice",3 "description": "This is a very long descriptio..."4}API Usage
curl -X POST https://your-domain.com/api/v1/utilities/cleanup.truncate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"inputs":{"primary":{"name":"Alice","description":"This is a very long description that goes on and on and should be truncated to a reasonable length for display purposes"}},"config":{"maxStringLength":30,"maxArrayLength":0,"removeLargeBlobs":false}}'1{2 "name": "Alice",3 "description": "This is a very long descriptio..."4}