json guide

Keep JSON null, Empty Strings and Missing Properties Distinct

Compare three valid JSON representations and preserve their differences when formatting or preparing data for a schema.

Published October 9, 2026 by SOLVEOZA Editorial

Quick answer

{"note":null}, {"note":""}, and {} are three different JSON objects. The first contains null, the second contains an empty string, and the third has no note property. What each means must come from the receiving application.

Separate JSON syntax from application meaning

JSON defines values and object members, but it does not decide whether a note is optional or whether null means unknown, deleted or not applicable. Those are schema or application rules. Do not replace one representation with another just to make an error disappear.

All three examples below are syntactically valid. A formatter can accept them even if an API would reject one. Syntax validation and contract validation answer different questions.

Inspect property presence and value separately

Use property presence as one question and value type as another. Reading only a displayed blank cell can hide this difference.

Three states
JSON objectHas note property?Value
{"note":null}Yesnull
{"note":""}YesEmpty string
{}NoNo value supplied
Original comparison fixture
[
  {"id":"A","note":null},
  {"id":"B","note":""},
  {"id":"C"}
]

Format without changing the states

Paste the array into JSON Formatter and choose Pretty. The spacing changes but A still has null, B still has an empty string, and C still has no note property. Choose Minify to remove formatting whitespace; it should preserve the same three distinctions.

The formatter does not add missing properties, validate a remote API schema or decide that blanks should be null. Inspect the actual values after formatting rather than assuming a successful result certifies the data for every destination.

Do not confuse empty with whitespace or the word null

The value " " is a one-space string, not an empty string. The value "null" is a four-character string, not JSON null. Zero, false and an empty array are different values again. A blanket replacement of every value that looks empty can discard legitimate data.

When preparing a mapping, list allowed source states explicitly. For example, a particular receiving schema might allow string or null and require the key. That is a hypothetical contract: it would permit the first two examples but not the third. A different schema could make the key optional and reject null.

Make a conversion decision reversible

Before changing records, keep the original representation and write down which rule authorizes each change. If an update API distinguishes omission from clearing a value, confusing those states may alter stored data. Read that API's own contract; this guide does not prescribe update semantics.

For CSV imports, remember that the SOLVEOZA converter outputs strings. Its empty cell becomes an empty string and the text null stays quoted. Any later conversion into JSON null belongs to an explicit schema-mapping step, not a cosmetic formatting step.

Methodology

  1. Parse original, pretty and minified fixtures and compare property presence and value types.
  2. Check null, empty string and omitted note independently.

Limitations

  • Not a schema validator or advice for a particular API.
  • No claim that all JSON numbers survive formatting exactly; the tool separately warns about unsafe integers.
  • Whitespace-only strings are not automatically normalized.

Sources

Original synthetic records illustrate JSON value and member distinctions; business meaning is deliberately not assigned.

FAQ

Does valid JSON mean my API accepts it?

No. JSON syntax does not establish application schema requirements.

Can the formatter choose between null and omission?

No. It preserves the supplied structure and has no knowledge of the receiving contract.

Is the string null the same as null?

No. Quoted null is text, whereas unquoted null is a JSON literal.

Is one space an empty string?

No. It is a string containing one character.

Continue the task