Distinguishing empty, null and missing JSON fields
An empty string, a null and a property that is not there look alike to a reader skimming a document, and they are three different JSON structures. This worksheet formats each one and shows that the formatter keeps them apart.
Three ways to say that there is no label
JSON gives a writer three distinct ways to leave a value blank. The property can be present with an empty string, as in {"label":""}. It can be present with the literal null, as in {"label":null}. Or it can be absent, as in {}. All three are valid JSON, and all three can be read as no label in casual speech. A program does not read casually. It sees a string of length zero, a null value, or a lookup that finds nothing, and these usually take different paths through code. The worksheet runs each through the formatter so you can see that the output records the difference. A person scanning a long document may read all three as no label, but a program does not scan, so the worksheet keeps the three inputs short enough to compare in one glance.
The empty string
In the first control the label property exists and its value is a string with no characters. The compact output is {"label":""}, with the two quotation marks holding nothing between them. Code that asks whether label is present gets yes, and code that asks for its length gets zero. The empty string suits a text field that is known to be blank, such as a form box the user left empty. It is still text, so a numeric field cannot use it without conversion, and a check for null will not find it. A value of one space looks empty on screen and is a different string again, one character long, so the formatter would preserve it as written.
The null value
In the second control label is present with the literal null, which JSON writes without quotes. The compact output is {"label":null}. Null is a value that means no value, and it is distinct from the string "null", which would carry quotation marks. Many APIs use null to say that a field is known to be unset, or that a previous value was cleared. In RFC 7396, the JSON Merge Patch format, a null in a patch document has a specific meaning: it removes the member from the target. That is a good example of null carrying instructions in addition to describing data. Compare it with a patch that sets label to an empty string, which keeps the member and replaces its text with nothing.
The absent property
The third control is an empty object, {}, with no label property at all. A lookup for label finds nothing, which in many languages returns an undefined or missing marker that differs from null. Absence often signals that the sender did not mention the field, as in a partial update where only changed fields are sent. A receiver that treats a missing property as a request to clear the value would erase data, and one that treats it as unchanged would keep it. Which reading is correct depends on the documentation for the receiving system.
Reading the compact output
The worksheet uses an indent of zero, which produces the compact form with no added whitespace. In that form each control comes back exactly as typed, so the three outputs can be compared character by character. Using an indent of 2 produces the same content spread over several lines, and the formatter keeps the same distinctions. An object with label null and note empty, for example, comes out as two indented lines, one ending in null and the other ending in two quotation marks with nothing between them. Reading both lines side by side makes the contrast easy to see. Formatting changes layout only, so a document that round-trips through the formatter has the same structure afterward, including any null or empty values it contained.
Schemas decide which forms are allowed
Whether a given form is acceptable is a rule of the system receiving the document, usually written in a schema or API description. A schema may make a field required, optional, or nullable. JSON Schema, a widely used description format, expresses these through the required list, the type keyword and the minLength keyword, among others. Required means the property must be present. Nullable means the value may be null when the property is present. Optional means the property may be absent. A string field might additionally require a minimum length, which rejects an empty string. These are independent settings, so a field can accept one of the three blank forms and reject the others, and syntax checking cannot tell you which.
Mixing the forms during conversion
Data often passes through several systems, and each may convert between blank forms. A database column with a null becomes null in JSON, a spreadsheet export might turn an empty cell into an empty string, and a serializer may drop null properties entirely to save space. Comparing documents from two sources can then show differences that reflect only the conversion choices. When you build or consume such data, state which blank form is used for unknown values and keep to it, and do not replace one form with another just to make the document shorter.
What the formatter does and leaves alone
The formatter validates syntax and lays out the text. It does not say whether a property should exist, whether null is allowed there, or what an empty string means for your application. Each control returns valid with the formatting you asked for, and that outcome does not tell you whether the receiving system will accept the document.
Choosing one blank form for your own data
When you design a document that others will read, pick one form for unknown values and document it. Many teams use null for a known but unset value and leave a property out when it does not apply to a record type. Others always send every property so that readers never need to test for presence. An empty string is best kept for text that is truly empty. Mixing the forms for the same field across messages forces every reader to handle all three. Writing the rule next to the field definition costs one sentence and saves a class of bugs in every consumer. Example payloads in the documentation should show each allowed blank form at least once. Reviewers can then check a new producer against those examples line by line.
Reproduce the checks
Present empty string
Open the Json Validator Formatter and enter:
- JSON input
{"label":""}- Indent
0
Expected output:
Valid
trueFormatted
{"label":""}The property exists and its value is a string.
Present null value
Open the Json Validator Formatter and enter:
- JSON input
{"label":null}- Indent
0
Expected output:
Valid
trueFormatted
{"label":null}The property exists with the null token.
Property absent
Open the Json Validator Formatter and enter:
- JSON input
{}- Indent
0
Expected output:
Valid
trueFormatted
{}There is no label property in this object.
References and implementation scope
The examples describe the behavior of the linked Computandum tools. A successful local check does not establish that another application accepts the same format or applies the same limits.
Sources
- Primary definition and convention reference ↗ · 2026-10-08