JSON guide · 2 min read
JSON null vs Missing vs Empty: What Each State Means
Distinguish null, missing properties, empty strings, empty arrays and empty objects so API and schema behavior stays explicit.
These states are not interchangeable
A property can be absent, present with null, present with an empty string, present with an empty array or present with an empty object. Each state carries different information and can trigger different application behavior.
{}
{"middleName":null}
{"middleName":""}
{"roles":[]}
{"profile":{}}Missing means no property was supplied
Omission can mean unknown, unchanged, not applicable or simply optional depending on the API. Patch-style updates often use omission to mean leave the existing value unchanged, which differs sharply from sending null.
null is an explicit JSON value
A property set to null is present in the payload and explicitly carries the null value. Some APIs interpret that as clear the value; others reject it unless the contract explicitly allows null.
Empty strings and collections are real values
An empty string is still a string, an empty array is still an array with zero items, and an empty object is still an object. Treating those as equivalent to null can erase useful meaning.
Model the distinction in JSON Schema
required controls whether a property must exist, while the property schema controls what values are allowed when it exists. That lets you express required-but-nullable and optional-but-non-null contracts deliberately.
Review diffs with state semantics in mind
A JSON diff that removes a property describes a different change from one that sets the same property to null. Before approving an API or configuration update, ask what each state means to the receiving system.
Common questions
Frequently asked questions
Is null the same as a missing property?
No. null is an explicit value on a present property, while a missing property is absent from the object.
Is an empty array equivalent to null?
No. An empty array is a valid collection with zero elements; null is a different JSON type.
How should PATCH APIs handle null?
The API contract should define it. A common pattern is omission for unchanged and null for clear, but that behavior is not universal.