How to remove null fields from json api payloads
- Step 1Drop the JSON payload file — Drag a
.json,.ndjson,.jsonl, or.txtfile onto the dropzone, or click to browse. There is no paste box — save the API response to a file first (for examplecurl ... -o response.json). The file must be a single valid JSON document; it is parsed withJSON.parse. - Step 2Pick the strip targets — Tick the values to remove.
null valuesis on by default. Addempty strings,empty arrays, andempty objectsonly if those are also noise in your payload. Skipundefined valuesfor file input — JSON files cannot contain undefined. - Step 3Choose Deep or shallow — Leave Deep (strip at all nesting levels) checked to clean the whole tree. Uncheck it to strip only the top-level object's keys or top-level array items and leave nested objects untouched — useful when you trust nested sub-resources as-is.
- Step 4Run Strip Values — Click Strip Values. The Strip Values button is disabled until a file is loaded and at least one target is selected. The header shows a 'N values stripped' count so you can confirm the pass did something.
- Step 5Diff against the original — Before wiring stripping into production, compare the cleaned payload against the original with json-diff to confirm only the intended keys vanished and no field with a real value was lost.
- Step 6Copy, download, or port to your serializer — Use Copy for the clipboard or Download to save
<name>.stripped.json. Then replicate the rule in your API layer — most frameworks expose a serializer hook (Jackson@JsonInclude(NON_NULL), .NETJsonIgnoreCondition.WhenWritingNull, FastAPIresponse_model_exclude_none=True).
Strip targets and what they remove from a payload
The five checkboxes map to exact value tests in the engine. Only the value shown is matched — near-matches are preserved.
| Checkbox | Matches exactly | Does NOT match (preserved) | Default |
|---|---|---|---|
null values | JSON literal null | false, 0, "", "null" (the string) | On |
undefined values | JS undefined (in-memory objects only) | Anything in a parsed file — JSON has no undefined | Off |
empty strings "" | A zero-length string "" | " " (a space), "0", "\n" | Off |
empty arrays [] | An array of length 0 | [null], [0], [""] (length 1) | Off |
empty objects {} | An object with zero own keys | {"a":null} (until null is also stripped, then it cascades) | Off |
Deep vs shallow on a nested response
Input {"user":{"id":1,"bio":null},"meta":null} with target null. Cascade in the third row needs both null and empty objects ticked.
| Mode + targets | Output | Why |
|---|---|---|
Deep ON, null | {"user":{"id":1}} | Recurses into user, drops bio, drops top-level meta |
Deep OFF, null | {"user":{"id":1,"bio":null}} | Only top-level keys tested; meta dropped, nested bio untouched |
Deep ON, null + empty objects | {"user":{"id":1}} (and user survives because it still has id) | If user had only bio, it would collapse to {} then be stripped |
File and tier limits
JSON Null Stripper is a Pro tool. Limits come from lib/tier-limits.ts and lib/csv-utils.ts.
| Limit | Free | Pro |
|---|---|---|
| Max file size | 2 MB | 100 MB |
| Files per run | 1 | Batch up to 10 |
| Accepted extensions | .json .ndjson .jsonl .txt | .json .ndjson .jsonl .txt |
| Where it runs | Your browser | Your browser |
Cookbook
Before/after fragments from real REST and GraphQL responses. IDs and emails are synthetic.
Trim a verbose user response
ExampleAn ORM serializer emits every column. Stripping null (Deep on, the defaults) leaves only populated fields and removes the need for ?. chains on the client.
Input (response.json):
{
"id": 42,
"name": "Ada",
"middleName": null,
"phone": null,
"verified": false,
"loginCount": 0
}
Strip Values (targets: null · Deep on):
{
"id": 42,
"name": "Ada",
"verified": false,
"loginCount": 0
}
2 values stripped. Note false and 0 survive.Collapse empty nested branches
ExampleA response carries a profile object whose only field is null. Ticking both null and empty objects removes the field, then the now-empty profile cascades away.
Input:
{
"id": 7,
"profile": { "avatarUrl": null }
}
Strip Values (targets: null + empty objects · Deep on):
{
"id": 7
}
2 values stripped (avatarUrl, then the empty profile).Clean a list response without losing real falsy data
ExampleAn array of records, some with null fields. Reindexing is automatic for any null array elements; objects keep their populated keys.
Input:
[
{ "sku": "A1", "discount": null, "inStock": true },
{ "sku": "B2", "discount": 0, "inStock": false }
]
Strip Values (targets: null · Deep on):
[
{ "sku": "A1", "inStock": true },
{ "sku": "B2", "discount": 0, "inStock": false }
]Keep null where it means 'cleared'
ExampleIf null is a deliberate signal (a tombstone the client must see), do NOT strip it. Leave the file unprocessed for that field, or only strip empty arrays/strings instead.
Input:
{ "id": 9, "avatarUrl": null, "tags": [] }
Strip Values (targets: empty arrays only · null UNCHECKED):
{ "id": 9, "avatarUrl": null }
The deliberate null survives; only the empty tags array is removed.Build a clean contract-test fixture
ExampleCapture a live response, strip nulls, and commit the result as the 'minimal expected shape' fixture so your test asserts presence of real fields without null noise.
$ curl -s https://api.example.com/v1/users/42 -o response.json # drop response.json -> Strip Values (null, Deep on) -> Download # saved as response.stripped.json $ mv response.stripped.json test/fixtures/user-minimal.json
Errors and edge cases
Real errors and silent failures sourced from each platform's own documentation. Match the wording to the row, fix what the row says to fix.
File is not valid JSON
Parse errorThe engine calls JSON.parse on the file text. A trailing comma, single quotes, an unquoted key, or a leading byte-order mark will throw and the run fails. Repair the source first with json-format-fixer, then strip.
NDJSON / JSONL with one object per line
Parse errorEven though .ndjson and .jsonl are accepted extensions, the engine parses the whole file as a single JSON document. A multi-line NDJSON file (separate objects on each line) is not one valid document and will not parse. Wrap the lines into a JSON array first, then strip.
`undefined` checkbox ticked on a file
By designTicking undefined values has no effect on file input because a parsed JSON document can never contain the JS undefined value. The option exists for parity with in-memory use; for files it is a no-op, not an error.
Field holds the string "null"
PreservedOnly the JSON literal null is matched. A string value "null" (for example a CSV-derived export where empties became the text 'null') is preserved. Convert those strings before stripping if you want them gone.
Whitespace-only string
Preservedempty strings matches only a zero-length "". A value of " " or "\n" is kept. Trim such values upstream if they should count as empty.
`false` or `0` you expected to be removed
PreservedThese are valid data, not null, so they are never stripped. A toggle response {"active": false} keeps active. There is no 'falsy' strip mode — that is intentional, since dropping false/0 corrupts boolean and metric fields.
Deep unchecked leaves nested nulls
ExpectedWith Deep off, only the top-level object's keys (or top-level array's items) are evaluated. Nulls inside nested objects survive. Turn Deep on to clean the whole tree.
All targets unticked
DisabledThe Strip Values button is disabled when no target is selected, so an empty-target run cannot be triggered. Tick at least one box.
Empty array vs missing field semantics
Caution"orders": [] (collected, zero results) is not the same as orders absent (never collected). Stripping empty arrays erases that distinction. Leave empty arrays unchecked when the empty state carries meaning to consumers.
File over the tier size limit
BlockedFree is capped at 2 MB per file; Pro raises it to 100 MB. A larger file is blocked before processing. Split the payload or upgrade.
Frequently asked questions
Does this upload my API payload anywhere?
No. The file is read locally with the browser FileReader and stripped in-page. Request bodies, response payloads, tokens, and PII never reach JAD Apps servers.
Can I paste JSON instead of uploading a file?
No — the tool is file-only. Save the response to a .json file (for example curl ... -o response.json) and drop it. There is no paste textarea.
Why doesn't the undefined option remove anything from my file?
JSON has no undefined token, so a parsed file can never contain it. The checkbox is meaningful only for in-memory JavaScript objects. For files, leave it off and use null (and optionally empty string/array/object).
Does it remove false and 0?
No. false and 0 are real values and are always preserved. Only null, and the empty-collection/empty-string targets you tick, are removed. There is no falsy-stripping mode.
What happens to a nested object that becomes empty after stripping?
If you have both null and empty objects ticked with Deep on, an object whose last field was a stripped null collapses to {} and is then itself stripped, cascading up the tree. With only null ticked, the empty {} is left in place.
Should my API omit null fields or send them explicitly?
Both are valid; the rule must be consistent and documented. Omitting nulls yields smaller payloads and fewer client null-checks. Sending explicit null is right only when 'present but cleared' must be distinguished from 'absent' — for example a PATCH tombstone.
How do I do the same thing in my server code?
Use the framework's serializer setting rather than hand-rolling: Jackson @JsonInclude(JsonInclude.Include.NON_NULL), System.Text.Json JsonIgnoreCondition.WhenWritingNull, FastAPI response_model_exclude_none=True, or in Node Object.fromEntries(Object.entries(obj).filter(([,v]) => v != null)) applied recursively.
Will the indentation match my codebase?
Output is pretty-printed at 2-space indent. There is no indent selector in the UI. If you need it minified for transport, run the result through json-minifier.
What file types can I drop?
.json, .ndjson, .jsonl, and .txt. Whatever the extension, the contents must be a single valid JSON document — line-delimited NDJSON with multiple top-level objects will not parse.
How do I verify nothing important was removed?
Run the original and the stripped file through json-diff. It lists exactly which keys were removed so you can confirm only nulls/empties (not real data) vanished.
Can it strip keys by name instead of by value?
No — this tool strips by value (null/empty). To remove or keep specific keys regardless of value, use json-key-filter.
Does stripping reduce response size meaningfully, and is there a row limit?
It depends on how sparse your payload is — responses where many optional columns are null can shrink noticeably once those keys are gone. There's no separate row limit, only the file-size cap (2 MB free, 100 MB Pro), so a large array of records is fine if the file fits. Pair stripping with json-minifier for transport.
Privacy first
Conversion runs locally in your browser. No file is uploaded — only metadata counters are saved for signed-in dashboard stats.