Truncate (Free Online Tool)

Reduce oversized payloads by truncating strings, capping arrays, and dropping large blobs

Paste your JSON → Get results instantly (no signup)

⚡ Instant resultsNo signupRuns in your browser
Try examples:

Truncate oversized values in this data for the "Truncate long strings"

{
"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"
}
Output
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.

Read integration guide

Works with:

  • API responses
  • Nested JSON
  • Arrays & objects

Example: input → output

Input / Output
Input
{
"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"
}
Output
{
"name": "Alice",
"description": "This is a very long descriptio..."
}

Related tools

Advanced usage (optional)

Truncate

v1.0.0
Cleanup
objectarraydestructive

Description

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

FieldTypeDefaultDescription
Target Pathspath-picker[]Scope operations to specific paths (empty = apply everywhere)
Max String Lengthnumber0Truncate strings beyond this character count (0 = no limit)
Max Array Lengthnumber0Keep only the first N array items (0 = no limit)
Remove Large BlobsbooleanfalseRemove base64 strings and long single-line values (>1KB)
Collapse Modeenumremoveremove (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

NameTypeDefaultDescription
Target Pathspath-picker[]Scope operations to specific paths only (empty = apply everywhere)
Max String Lengthnumber0Truncate strings longer than this many characters (0 = no limit)
Max Array Lengthnumber0Keep only the first N items in arrays (0 = no limit)
Remove Large BlobsbooleanfalseRemove base64 strings and long single-line values larger than 1KB
Max Depthnumber0Truncate nesting beyond this many levels (0 = no limit)
Max Keysnumber0Keep only the first N keys per object (0 = no limit)
Collapse Modeenumremoveremove: silently cut extra items. placeholder: replace with summary like '[...5 more items]' remove placeholder

Examples

AI Prompt
Truncate oversized values in this data for the "Truncate long strings" example.
{
"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"
}
Output
1{
2 "name": "Alice",
3 "description": "This is a very long descriptio..."
4}
Config
Max String Length
30
Max Array Length
0
Remove Large Blobs
OFF

API Usage

POST /api/v1/utilities/cleanup.truncate
Example:
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}}'
Response
1{
2 "name": "Alice",
3 "description": "This is a very long descriptio..."
4}