One signup webhook, 12 removals
Press Load the signup webhook. The sample is a newsletter signup the way a form service posts one: a subscriber block, UTM tags, consent flags, plus the fields nobody filled in. With the three default rules on, the log lists 12 paths.
Removed
- 6 nulls:
subscriber.phone,subscriber.address.country, the threeutmtags,unsubscribed_at - 3 empty strings:
subscriber.company,subscriber.address.city, the blank fourth item intopics - 3 containers:
subscriber.addressandutm, both emptied by the rules above, plusattachments: []
Kept on purpose
"marketing": false, a recorded choice"referrer_count": 0, a real count"notes": " ", three spaces are text until Trim runs- The second
"json"intopics - The padding around
" Priya Raman "
At a 2-space indent the payload drops from 616 bytes to 381. The meter prints both sides at the indent you picked. The difference is removed values, not a whitespace change. Paste minified JSON, print the result pretty, and a naive counter would report a bigger file after cleaning.
Now tick Trim strings and Duplicates in arrays. The name loses its padding. notes trims down to "" and leaves under the empty string rule. The second "json" goes. The log grows to 15 rows.
What each rule removes, and where each one stops
- Null values
- Removes any key whose value is
null, plus null items inside arrays. A protected key keeps its null. - Empty strings
- Removes
""and nothing else. A value of spaces or a lone tab stays, unless Trim strings runs first and reduces the value to"". - Empty objects, arrays
- Runs after the children are cleaned, so a block emptied by other rules goes too.
subscriber.addressheld two blank fields and left with them. The top level is never removed. Clean{"a": null}and you get{}, not an empty file. - Trim strings
- Strips whitespace from the start and end of string values. Keys stay as written. Spaces between words stay.
- Duplicates in arrays
- Compares items after cleaning, with object key order ignored.
{"x":1,"y":2}and{"y":2,"x":1}count as one item. The first copy stays."1"and1differ, since one is a string. - Sort keys A to Z
- Orders by character code, so
Zonesorts beforeapple. Keys made only of digits, such as"2024"or"10", print first in numeric order whether sorting is on or off. JavaScript objects store integer-like keys that way, and the cleaner works on a parsed object.
When null carries meaning
Most nulls in a payload mean "no value yet". Some formats treat null as an instruction, and cleaning those bodies changes what the request does.
JSON Merge Patch, RFC 7396. A null member means delete. Send {"phone": null} to an endpoint built on merge patch and the stored phone number is cleared.
Run the body through a cleaner first and the request becomes {}, an empty patch. The phone number stays on the record, and nobody gets an error.
Soft-delete fields such as deleted_at or unsubscribed_at follow the same pattern. So do OpenAPI schemas where a property is required but nullable. Remove the key and the validator rejects the record, even though the value was legal.
Type those names into Protected keys, comma separated. Their values survive at any depth, null or blank. Items inside a protected array or object still go through the rules. Protection matches the key name, not a full path, so protecting id protects every id in the file.
No "remove undefined" switch, on purpose
JSON has six kinds of value: object, array, string, number, true or false, and null. undefined is a JavaScript value. JSON.stringify drops undefined before any JSON text exists, so a pasted document never contains one. An undefined toggle on a JSON cleaner switches nothing. The earlier version of this page had one. The switch is gone.
There is no switch for false or 0 either. A subscriber who declined marketing email is false. A referrer count of zero is a measurement. Removing either one edits the data, and a reader of the cleaned file would read the gap as "unknown".
Limits before you paste production data
- Integers past 2^53 get rounded. The cleaner parses the text into JavaScript numbers.
1234567890123456789prints as1234567890123456800. A yellow note under the output names the first one found. Quote ids like this at the source. The JSON Minifier copies digits as written, though the minifier only removes whitespace. - Number spelling is normalized.
1.0prints as1,1e3as1000. The values are equal. A byte-for-byte diff will still flag them. - Duplicate keys keep the last copy.
{"id":1,"id":2}comes out as{"id":2}, with no log row for the lost value. - Comments, trailing commas, single quotes stop the run. The message gives a line and column. The JSON Fixer attempts repairs. This page does not guess.
- Large input waits for a click. Above 2 million characters, cleaning on every keystroke is off. Press Clean. The log shows the first 400 rows. The output has every change applied.
- Nothing is uploaded. Parsing, cleaning, copy and download all run in the browser tab.
Check the result against the original
The log names each path removed. For both documents side by side, paste the source and the cleaned output into JSON Diff. Want keys reordered with no values removed? Use the JSON Sorter. Want a smaller file with every value intact? The minifier removes whitespace and touches nothing else.