Can DynamoDB have null values?
Yes. DynamoDB has a dedicated NULL type that represents an attribute with an unknown or undefined state. It also allows empty strings and empty binary values for non-key attributes, plus empty lists and maps. It does not allow empty sets (string, number, or binary), which are rejected with a ValidationException.
The NULL type
NULL is a real attribute type, written as {"NULL": true}. Use it when you want to record that a field exists but has no value — distinct from simply omitting the attribute.
What empties are allowed
- Empty string / empty binary — allowed on non-key attributes, and inside lists and maps.
- Empty list / empty map — allowed.
What is not allowed
- Empty sets (SS, NS, BS) — rejected with a
ValidationException. - Empty string or binary on a key attribute — key values must have length greater than zero.
What the rejections look like
One PutItem accepted {"NULL": true}, {"S": ""}, {"L": []}, {"M": {}} and a zero-byte {"B": ""} in the same item, and GetItem returned all five unchanged. These three writes did not survive. The messages are the engine's own, wrapped to fit and otherwise untouched, typo included:
tags: {"SS": []}
ValidationException: One or more parameter values were invalid:
An string set may not be empty
pk: {"S": ""}
ValidationException: One or more parameter values are not valid.
The AttributeValue for a key attribute cannot contain an empty
string value. Key: pk
gsiKey: {"NULL": true}
ValidationException: Invalid attribute value typeThat third one is the trap. You cannot null out an index key to keep an item out of a sparse index: the whole write is rejected, so the only way to leave an item unindexed is to omit the attribute.
NULL counts as present
Every filter treats a NULL attribute as there. Scanning the item above with attribute_exists(explicitNull) returned it, and so did explicitNull = :n with :n set to {"NULL": true}, and attribute_type(explicitNull, "NULL"). Only attribute_not_exists separates "explicitly null" from "not stored".
Modeling tip
Omitting an attribute entirely is often cleaner than storing NULL, and it enables sparse indexes. Choose based on whether "absent" and "explicitly null" mean different things in your model.
Building filters around NULL
Filter expressions treat NULL as present. To find items with an explicit null, use attribute_type(attr, 'NULL') or compare against :n with {"NULL": true}. To exclude them, use attribute_not_exists or test for a concrete type such as attribute_type(attr, 'S'), depending on your model.
The Expression Builder generates the name/value maps for attribute_exists and attribute_not_exists filters so you can sanity-check a Scan before you pay for it.
In DynoTable: the item editor writes NULL attributes in all three JSON modes. Open a row, set a field to null, and stage the change for review before it commits. See Editing items.
Go deeper
Read DynamoDB data types and sparse indexes. Download DynoTable to edit attributes, including NULL, directly.
References
- Supported data types and naming rules in Amazon DynamoDB — Amazon DynamoDB Developer Guide
- Constraints in Amazon DynamoDB — Amazon DynamoDB Developer Guide
- PutItem — Amazon DynamoDB API Reference
Last verified 2026-07-13 against the official AWS documentation linked above.
Reproduced 2026-07-28 against DynamoDB Local 3.3.0 via @aws-sdk/client-dynamodb 3.1095.0 — the error strings and filter results above are verbatim engine output. The live service can word a ValidationException differently from the local engine.