Clean Values

v1.0.0
Cleanup
objectarraydestructive

Description

Clean Values

Remove nulls, empty strings, empty collections, default values, and duplicates from JSON data. Optionally trim whitespace, sort keys, and truncate oversized content. A comprehensive cleanup utility for normalizing messy data.

Operations

Each cleanup operation can be toggled independently. Enable multiple operations to clean data in a single pass.

Remove Null Values

Delete object keys that have null values at any depth.

Remove Empty Strings

Delete object keys that have empty string "" values.

Remove Empty Collections

Delete empty objects {} and empty arrays [].

Remove Default Values

Delete falsy defaults — 0 and false. Useful for stripping placeholder values.

Remove Duplicates

Remove duplicate items in arrays. Compares both primitive values and full objects (deep equality).

Trim Whitespace

Trim leading and trailing whitespace from all string values throughout the document.

Sort Keys

Sort object keys alphabetically at all levels.

Max String Length

Truncate strings longer than a specified character count (0 = no limit).

Max Array Length

Keep only the first N items in arrays (0 = no limit).

Remove Large Blobs

Remove base64 strings and long single-line values larger than 1KB.

Configuration

FieldTypeDefaultDescription
Target Pathspath-picker[]Scope operations to specific paths only (empty = apply everywhere)
Remove Null ValuesbooleanfalseRemove object keys with null values
Remove Empty StringsbooleanfalseRemove object keys with empty string values
Remove Empty CollectionsbooleanfalseRemove empty objects {} and arrays []
Remove Default ValuesbooleanfalseRemove falsy defaults (0, false)
Remove DuplicatesbooleanfalseRemove duplicate items in arrays
Trim WhitespacebooleanfalseTrim leading/trailing whitespace from strings
Sort KeysbooleanfalseSort object keys alphabetically
Max String Lengthnumber0Truncate strings beyond this length (0 = no limit)
Max Array Lengthnumber0Keep only first N array items (0 = no limit)
Remove Large BlobsbooleanfalseRemove base64 and large single-line values (>1KB)

Use Cases

API Response Cleanup

  • Strip null fields from API responses before displaying
  • Remove internal metadata fields (__v, _id) with empty values
  • Trim whitespace from user-submitted form data

Data Normalization

  • Deduplicate records imported from multiple sources
  • Sort keys for consistent ordering across objects
  • Remove placeholder defaults before exporting

Size Reduction

  • Truncate long description fields for preview displays
  • Cap large arrays to a manageable size
  • Strip base64-encoded images and binary blobs

Configuration

NameTypeDefaultDescription
Target Pathspath-picker[]Scope operations to specific paths only (empty = apply everywhere)
Remove Null ValuesbooleanfalseRemove object keys that have null values
Remove Empty StringsbooleanfalseRemove object keys that have empty string values
Remove Empty CollectionsbooleanfalseRemove empty objects {} and empty arrays []
Remove Default ValuesbooleanfalseRemove falsy defaults (0, false)
Remove DuplicatesbooleanfalseRemove duplicate items in arrays (primitives and objects)
Trim WhitespacebooleanfalseTrim leading and trailing whitespace from all string values
Sort Object KeysbooleanfalseSort object keys alphabetically
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

Examples

AI Prompt
Clean up this JSON and remove noisy values and remove nulls and empties.
Input
1{
2 "name": "Alice",
3 "bio": "",
4 "age": 30,
5 "address": null,
6 "tags": [],
7 "meta": {}
8}
Config
Remove Null Values
ON
Remove Empty Strings
ON
Remove Empty Collections
ON
Remove Default Values
OFF
Remove Duplicates
OFF
Trim Whitespace
OFF
Sort Object Keys
OFF
Output
1{
2 "name": "Alice",
3 "age": 30
4}

API Usage

POST /api/v1/utilities/cleanup.clean-json
Example:
curl -X POST https://your-domain.com/api/v1/utilities/cleanup.clean-json \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"inputs":{"primary":{"name":"Alice","bio":"","age":30,"address":null,"tags":[],"meta":{}}},"config":{"removeNulls":true,"removeEmptyStrings":true,"removeEmptyCollections":true,"removeDefaults":false,"removeDuplicates":false,"trimStrings":false,"sortKeys":false}}'
Response
1{
2 "name": "Alice",
3 "age": 30
4}