JSON Null Remover

Recursively strip null values — and optionally empty strings, arrays and objects — out of any JSON document. Runs in your browser; nothing is uploaded.

Try:
Cleaned JSON

About this tool

JSON Null Remover parses your JSON, walks the whole tree, and drops every object key whose value is null — at any depth, including objects nested inside arrays. What's left is re-serialized as valid JSON, pretty-printed or minified. Payloads from ORMs, form submissions and API responses shrink noticeably once the placeholder nulls are gone.

Emptiness beyond null is opt-in, one checkbox each: empty strings (""), empty arrays ([]) and empty objects ({}). Nothing else is touched — false and 0 are real values and are always kept, and the original key order is preserved.

Removal is bottom-up, so it cascades. Children are cleaned before their parent decides what to drop: with Also remove empty objects on, {"a": {"b": {"c": null}}} collapses all the way to {}, because each level is emptied in turn. With that box off, you get {"a": {"b": {}}} — the null is gone but the structure stays.

Worked example

Input:

{ "name": "Ada", "nickname": null, "address": { "city": "London", "zip": null } }

With the defaults (nulls only, Indent = 2), the output is:

{
  "name": "Ada",
  "address": {
    "city": "London"
  }
}

Now the same input with Also remove empty objects on and every value under address null — {"name": "Ada", "address": {"zip": null}} — collapses to {"name": "Ada"}: the emptied address object goes too.

Options

Limits and behavior

FAQ

Does it remove nulls inside nested objects and arrays?

Yes. The prune is recursive and reaches every level: keys with null values are removed from objects at any depth, including objects that live inside arrays. Whether a bare null element of an array is removed depends on the Values inside arrays setting.

What happens to a null sitting directly in an array?

With Values inside arrays = Compact (the default) it's dropped and the array closes up, so [1, null, 2] becomes [1, 2]. Choose Keep when array positions matter — a fixed-length row or tuple — and the null stays put while objects inside the array are still cleaned.

Are `false` and `0` removed too?

No, never. Only null is removed by default; empty strings, empty arrays and empty objects are removed only when you tick their boxes. Booleans and numbers are always kept, so false, 0 and 0.0 survive untouched — losing them is the classic bug in hand-rolled "remove empty" code.

If removing a null leaves an empty object, is that removed as well?

Only if Also remove empty objects is on — and then yes, it cascades. The tree is cleaned bottom-up, so an object emptied by the prune is itself dropped, which can empty its parent, and so on up to the root. With the box off, the emptied {} stays where it is.

Is the key order preserved?

Yes. Surviving keys come out in exactly the order they appeared in the input. If you also want them alphabetized for clean diffs, run the result through the JSON key sorter tool.

What if my JSON is invalid?

You get an invalid JSON error naming the line and column of the problem, and nothing is removed. The document is validated before the prune, so you never get half-cleaned or garbled output.

Is my data uploaded anywhere?

No. The whole thing runs in your browser via WebAssembly — the JSON never leaves your device, and there's no account or upload step.

Developer & Automation Access

Run it from the terminal

Same engine as this page, headless — via the gizza CLI:

gizza tool json-remove-nulls '{ "name": "Ada", "nickname": null, "address": { "city": "London", "zip": null } }'

New to the CLI? Get gizza →

Open it by URL

Pre-fill and auto-run this tool with query parameters — the names match the API/CLI:

https://gizza.ai/tools/json-remove-nulls/?json=%7B%20%22name%22%3A%20%22Ada%22%2C%20%22nickname%22%3A%20null%2C%20%22address%22%3A%20%7B%20%22city%22%3A%20%22London%22%2C%20%22zip%22%3A%20null%20%7D%20%7D&remove_empty_strings=true&remove_empty_arrays=true&remove_empty_objects=true&trim_strings=true&arrays=compact&indent=2

Machine-readable descriptor: tool.json — title + parameters JSON Schema for agents.