Remove nulls from JSON

Input
Output

Remove Null and Empty Values

Clean up JSON by stripping null values, empty strings, empty arrays and empty objects at every level. Zero and false are kept.

Example: cleaning up a user record

A record with null, empty strings, an empty list and an empty object, at different depths. With Remove set to everything empty, they all go, and so does address.geo once it's empty; the 0 and false stay:

Input

{
  "id": 7,
  "name": "Ananya",
  "nickname": null,
  "phone": "",
  "tags": [],
  "address": {
    "line2": null,
    "city": "Pune",
    "geo": {}
  },
  "orders": [
    {
      "id": "ORD-1",
      "coupon": null,
      "qty": 0,
      "gift": false
    }
  ]
}

Output

{
  "id": 7,
  "name": "Ananya",
  "address": {
    "city": "Pune"
  },
  "orders": [
    {
      "id": "ORD-1",
      "qty": 0,
      "gift": false
    }
  ]
}

How do I use the Remove nulls from JSON?

  1. Paste JSON.
  2. Choose what to remove: nulls, empties, or both.
  3. Copy the cleaned JSON.

What does the Remove nulls from JSON do?

  • Works at every level
  • Zero and false are kept
  • Nulls only, empties only, or both

When to use the Remove nulls from JSON

APIs and exports often fill records with null, empty strings and empty lists for fields that have no value. Stripping them makes a payload shorter and easier to read, keeps test fixtures and documentation examples to the point, and avoids sending empty fields an API would reject.

Remove has three settings: nulls and empty values (all of them), nulls only, or empty strings, arrays and objects only. It works at every depth, inside arrays too, and an object or array that becomes empty once its contents are removed goes as well. 0 and false are real values, so they're always kept.

Frequently asked questions

What's the difference between null and missing?
A key with null says the value is unknown or cleared; a missing key says nothing. Many APIs treat them differently, for example when updating a record, so remove nulls only when the receiver doesn't care.
Will it remove whitespace-only strings like " "?
No. Only strings that are completely empty are removed; a space is a value. Trim them first if you need to (Find & replace with ^\s+$ works).
Will it remove 0 or false?
No. Only null, empty strings, empty arrays and empty objects are removed.
Is my data uploaded?
No. Bracely runs entirely in your browser, so nothing you paste or open leaves your device.

More JSON tools

Bracely has 108 JSON tools in one page. Related ones:

Runs entirely in your browser. Nothing you paste is uploaded. Made by Saurabh Pagrut · About · Privacy policy
Last updated · Version 6.7 · Changelog
Saurabh Pagrut on GitHub · LinkedIn · X · YouTube · Instagram