Remove Null Values from JSON
Remove null fields from webhook payloads, API responses, and form submissions before validation, diffing, CSV export, or storage.
Paste your JSON → Get results instantly (no signup)
→ remove noisy values and remove nulls and empties.
1{2 "name": "Alice",3 "age": 304}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:
- Webhook payload cleanup
- API responses with null fields
- Form submissions
- CSV and validation prep
Example: input → output
Remove null values from JSON
Remove null values from JSON when webhook payloads, API responses, or form submissions contain empty fields that should not continue into validation, CSV export, or storage. This page uses the same cleanup engine as Clean JSON, but the intent is narrower: drop null fields while keeping meaningful values easy to inspect.
Input
{
"event": "order.paid",
"orderId": "ORD-1001",
"customer": { "name": "Alice", "phone": null },
"coupon": null
}
Output
{
"event": "order.paid",
"orderId": "ORD-1001",
"customer": { "name": "Alice" }
}
How to remove null values
Paste your JSON, enable null removal, and run the cleanup. The output keeps objects, arrays, strings, numbers, and booleans, but removes fields where the value is exactly null. Use the result before validation, diffing, CSV export, or pipeline automation.
If empty strings should also disappear, use the broader Clean JSON page. If null has business meaning in your API, keep it instead of deleting it.
When to use this tool
Use this tool for practical cleanup before another workflow:
- Remove null webhook fields before debugging handlers.
- Clean API responses before converting them to CSV.
- Prepare form submissions for validation or storage.
- Reduce noisy payloads before comparing JSON changes.
Null removal risks
Some systems treat null as an explicit signal. In a PATCH request, phone: null may mean “clear this phone number,” while a missing phone field may mean “leave it unchanged.” Remove null values only when missing and null are equivalent for the next consumer.
Related tools
- Clean JSON - broader cleanup for nulls, empty strings, sorting, and trimming.
- JSON Formatter - format and clean pasted JSON.
- API response formatter - clean vendor and webhook payloads.
- JSON to CSV - export cleaned records to CSV.
Related tools
Read more on the blog
Advanced usage (optional)
Clean Values
v1.0.0Description
Clean Values
Remove nulls, empty strings, empty collections, default values, and duplicates from JSON data. Optionally trim whitespace and sort keys. 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 object keys
Sort object keys alphabetically at all levels.
Configuration
| Field | Type | Default | Description |
|---|---|---|---|
| Apply to | path-picker | [] | Scope operations to specific paths only (empty = apply everywhere) |
| Remove null values | boolean | true | Remove object keys with null values |
| Remove empty strings | boolean | true | Remove object keys with empty string values |
| Trim whitespace | boolean | true | Trim leading/trailing whitespace from strings |
| Remove empty collections | boolean | false | Remove empty objects {} and arrays [] |
| Remove duplicates | boolean | false | Remove duplicate items in arrays |
| Remove default values | boolean | false | Remove falsy defaults (0, false) |
| Sort object keys | boolean | true | Sort object keys alphabetically |
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
Configuration
| Name | Type | Default | Description |
|---|---|---|---|
| Apply to | path-picker | [] | Scope operations to specific paths only (empty = apply everywhere) |
| Remove null values | boolean | true | Remove object keys that have null values |
| Remove empty strings | boolean | true | Remove object keys that have empty string values |
| Trim whitespace | boolean | true | Trim leading and trailing whitespace from all string values |
| Remove empty collections | boolean | false | Remove empty objects {} and empty arrays [] |
| Remove duplicates | boolean | false | Remove duplicate items in arrays (primitives and objects) |
| Remove default values | boolean | false | Remove falsy defaults (0, false) |
| Sort object keys | boolean | true | Sort object keys alphabetically |
Examples
Clean up this JSON and remove noisy values and remove nulls and empties.1{2 "name": "Alice",3 "age": 304}API Usage
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}}'1{2 "name": "Alice",3 "age": 304}