Clean Object
AI-generatedSummary
Clean an object by trimming strings, collapsing repeated whitespace inside strings, and optionally removing empty fields (empty strings, null, or undefined).
Inputs
- Trim Strings — Whether to trim leading and trailing whitespace from strings (default true).
- Collapse Whitespace — Whether to collapse repeated whitespace inside strings into single spaces (default true).
- Remove Empty Fields — Whether to remove empty strings, null values, and undefined values from the object (default false).
Output shape
a single object with cleaned property values reflecting the applied trimming, whitespace collapsing, and optional removal of empty fields, preserving the original structure but with cleaned strings and possibly fewer fields.
The cleaning recursively processes nested objects and arrays. If Remove Empty Fields is enabled, fields with empty string, null, or undefined values are removed from the object or array elements. The output is paired one-to-one with each input item.
Examples
Example 1: Input object with string properties containing extra spaces and empty entries
Trim Strings = true, Collapse Whitespace = true, Remove Empty Fields = true (optional)