Skip to content
XUtilHub

JSON Cleaner – Remove Nulls & Empty Values

Clean JSON online: remove null values, empty strings, empty arrays and objects, then format the result. Free JSON cleanup tool.

  • Free, no sign-up
  • Runs in your browser, nothing uploaded
Input
Output

About the JSON Cleaner

Strip noise out of JSON documents. Choose whether to remove nulls, empty strings, empty arrays and empty objects; the tool cleans recursively and formats the output.

Key features

  • Remove null values recursively
  • Remove empty strings, arrays and objects
  • Choose exactly which kinds of empty values to strip
  • Cleans nested structures at any depth
  • Output is validated and pretty-printed
  • Runs entirely in your browser

What does the JSON Cleaner do?

Real-world JSON is often full of noise: null fields that were never filled in, empty strings from blank form inputs, and empty arrays and objects left over from defaults. The JSON Cleaner strips these out recursively, leaving only data that actually has a value.

Example

{
  "name": "Ada",
  "nickname": "",
  "phone": null,
  "tags": [],
  "address": { "line2": "", "city": "London" },
  "meta": {}
}

Cleaned with all options on:

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

Options explained

OptionRemovesKeeps
Remove nulls"x": null, null inside arrays0, false, ""
Empty strings"" and whitespace-only strings"0", "false"
Empty arrays[][null] (unless nulls are removed too)
Empty objects{}Objects with at least one remaining key

When to clean JSON

  • Before storing documents. Smaller documents mean lower storage and index costs in MongoDB, Firestore or Elasticsearch.
  • Shrinking API responses. Omitting empty fields can cut payload size significantly.
  • Preparing test fixtures. Clean fixtures are easier to read and maintain.
  • Comparing data. Removing noise first makes JSON Compare results more meaningful.
  • Exporting to CSV or Excel. Fewer empty columns in JSON to CSV output.

A word of caution

Sometimes null and "missing" mean different things. In a PATCH request, for example, "email": null may mean "clear the email", while leaving email out means "don't change it". Clean data that you're sending to an API only if you know the API treats them the same.

After cleaning, minify the result for transport or sort the keys for review.

How to use the JSON Cleaner

  1. Paste your data into the input box, upload a file, or click Sample to try it out.
  2. Adjust the options above the editor if you need to (indentation, delimiter, and so on).
  3. The result appears instantly in the output panel. Any errors are shown with their line and column.
  4. Click Copy to copy the result, or Download to save it as a file.

Frequently asked questions

Will removing an empty array also remove its parent if the parent becomes empty?

Yes, when 'Empty objects' is enabled. Cleaning works from the inside out, so an object whose only properties were empty is itself removed.

Does the cleaner remove false or 0?

No. false and 0 are meaningful values, not empty ones, so they are always kept.

Is a string containing only spaces treated as empty?

Yes. With 'Empty strings' enabled, strings that are blank after trimming are removed.

Can I undo the cleaning?

Your original input stays in the left panel, so you can change the options and re-run as often as you like.

Is my JSON uploaded to a server?

No. All JSON tools run entirely in your browser, so your data never leaves your device.

Is there a size limit?

There is no fixed limit. Files of several megabytes work fine; very large files depend on your device's memory.

Do I need an account?

No. Every JSON tool is free and works without signing up.

Last updated:

Related JSON tools