SmartQueryTools

Fill Empty Values in JSON Files Online

Fill empty and null values in JSON files with a custom replacement value, directly in your browser.

How to fill Empty Values in JSON files

  1. Drop your file onto the upload area. The tool counts the NULL values in every column and lists each column that has any, marked as numeric, text, or another type that is left as is.
  2. Type the replacement for text columns in Fill text nulls with. It starts empty, which fills with an empty string.
  3. To fill number columns too, tick Also fill numeric nulls and set the Numeric fill value. The default is 0.
  4. Click Fill Empty Values and check the preview.
  5. Click Download to save the filled file in the same format you uploaded.

Your file is processed locally in your browser and is never uploaded. The free limit is 50 MB per file; larger files work if your device has the memory for them.

Worked example

A library exports its loan records for a monthly report. Missing renewal counts mean the loan was never renewed, and missing notes should read "none" rather than appearing blank.

Input (JSON)

[
  {
    "branch": "Central",
    "title": "The Overstory",
    "renewals": 2,
    "notes": "damaged cover"
  },
  {
    "branch": "Eastside",
    "title": "Piranesi",
    "renewals": null,
    "notes": null
  },
  {
    "branch": "Central",
    "title": "Klara and the Sun",
    "renewals": 0,
    "notes": null
  },
  {
    "branch": "Northgate",
    "title": null,
    "renewals": 1,
    "notes": "reserved"
  }
]

Settings

  • Fill text nulls with: none
  • Also fill numeric nulls: ticked
  • Numeric fill value: 0

Result

branchtitlerenewalsnotes
CentralThe Overstory2damaged cover
EastsidePiranesi0none
CentralKlara and the Sun0none
Northgatenone1reserved

Two notes and one renewal count were NULL, and they are now "none" and 0. The missing title is also "none": the text fill value applies to every text column that has NULLs, not only notes. Values that were already present, including the real 0 renewals for Klara and the Sun, are unchanged.

Working with JSON files

In a JSON array, both "key": null and a missing key count as NULL, because every object is loaded against one shared set of columns. Filling therefore also adds the key to objects that never had it. After a fill with "unknown", every object carries that key with a real value. An empty string "" is a value, not a null, and is not filled.

JSON numbers are filled with the numeric fill value only when Also fill numeric nulls is ticked. Otherwise they stay null. Booleans, nested objects and arrays are not filled, so their nulls stay null while string keys are filled. Flatten first if you need to fill a nested field. The output is a pretty-printed JSON array.

Frequently Asked Questions

Are missing JSON keys filled as well as null values?

Yes. A missing key and an explicit null both load as NULL, so both are filled, and the key is present in every object of the output.

Can I fill nulls inside nested JSON objects?

No. The tool works on top-level keys. Flatten the JSON first so nested fields become their own columns, then fill them.

Are empty strings treated as missing?

No. Only NULL values are counted and filled. In CSV and Excel files, blank cells load as NULL, so they are filled. In Parquet and JSON, an empty string is a real value and is left alone.

Can I use a different fill value for each column?

No. There is one value for all text columns and one optional value for all numeric columns. Date, boolean and nested columns are not filled. For per-column values, use the SQL Query tool with COALESCE, or Coalesce Columns to fill from another column.

Are numeric columns filled by default?

No. Numeric NULLs stay NULL unless you tick Also fill numeric nulls. That is deliberate, because filling with 0 changes sums, averages and counts.

Related Tools