
Options
Paste JSON and every field set to null is removed as you type, at every level of nesting. You can also strip empty strings, whitespace-only strings, empty objects and arrays, and false or 0 values, and protect fields you want to keep, like deletedAt. The Removed tab lists the path and line of everything that was taken out, so you can check the result before you use it. Long numbers and IDs stay exact, and JSON Lines files are cleaned line by line. Everything runs in your browser.
How to remove null values from JSON
- Paste your JSON into the left pane, or open a .json or .jsonl file.
- The cleaned JSON appears on the right. If the JSON has an error, the exact line and column are shown.
- Under Options, pick anything else to remove, and list any fields that should stay in Never remove.
- Open the Removed tab to review what was taken out. Click a row to jump to it in your JSON.
- Click Copy or Download.
What each option removes
| Option | Removes | Example |
|---|---|---|
null | Fields whose value is null | "phone": null |
| Empty strings | Fields set to an empty string | "nickname": "" |
| Whitespace-only strings | Strings that hold only spaces, tabs, or line breaks | "note": " " |
| Empty objects | Objects with no fields, including ones left empty after cleanup | "geo": {} |
| Empty arrays | Arrays with no items, including ones left empty after cleanup | "tags": [] |
false and 0 | Boolean false and numbers equal to zero | "retries": 0 |
| In arrays: Remove matching items | Matching items inside arrays, not just object fields | [1, null, 3] becomes [1, 3] |
Cleanup works from the inside out. With Empty objects turned on, an object that only held null fields is removed in the same pass, and so is its parent if that leaves the parent empty too.
Fields vs. array items
By default only object fields are removed, and arrays keep every item. In an array, position often carries meaning: [-122.67, 45.52] is a longitude and latitude, and a row of table cells lines up with its headers. Dropping a null from the middle shifts everything after it. If your arrays are plain lists, like tags or IDs, switch In arrays to Remove matching items.
Why remove null fields?
- Safer PATCH requests: with JSON Merge Patch (RFC 7396) and many REST APIs, sending
nullmeans "clear this field." Stripping nulls you didn't mean to send keeps you from erasing data. - Smaller payloads: API responses and exports often carry dozens of empty fields per record. Removing them cuts size before storage or transfer.
- Fewer validation errors: JSON Schema, TypeScript types, and strict deserializers often reject
nullwhere a string or number is expected, but accept a missing optional field. - Easier reading: without empty fields, the data that matters is much easier to scan.
Removing nulls with code
With jq, jq 'del(..|nulls)' file.json removes every null, including null items inside arrays. In JavaScript, JSON.stringify(data, (k, v) => v === null ? undefined : v) removes null fields from objects, but nulls inside arrays stay, because JSON.stringify writes undefined array items as null. In Python, a short recursive function works: rebuild each dict with {k: clean(v) for k, v in d.items() if v is not None} and each list with [clean(v) for v in items]. When you control the serializer, most libraries can skip nulls on output: NullValueHandling.Ignore in Json.NET, JsonIgnoreCondition.WhenWritingNull in System.Text.Json, and @JsonInclude(Include.NON_NULL) in Jackson.
Frequently asked questions
Does it remove nulls from nested objects?
Yes. Every object at every depth is cleaned, including objects inside arrays.
Will it remove null items from arrays?
Only if you choose Remove matching items under In arrays. By default arrays keep every item, so positions and lengths don't change.
Can I keep some null fields?
Yes. Type their names in Never remove, separated by commas. Those fields stay wherever they appear, even when their value is null or empty.
What happens to objects that end up empty?
They stay as {} unless Empty objects is turned on. The tool tells you how many objects or arrays were left empty, so you can decide.
Does it change my numbers or other values?
No. Values that aren't removed are written back exactly as they were, including large IDs like 9007199254740993 that many JSON tools round.
Does it work with JSON Lines or NDJSON?
Yes. If each line is its own JSON value, the tool detects it, cleans every line, and keeps one record per line in the output.
Can I clean JSON that has comments?
Yes, with Allow comments and trailing commas turned on. The comments are dropped in the output, because standard JSON can't hold them.
Is my JSON uploaded anywhere?
No. Cleaning happens in your browser and nothing is sent to a server.
