- Newest
- Most votes
- Most comments
There appears to be a behavior change between DynamoDB Local versions 2.6.1 and 3.1.0 in how empty map values are represented in responses.
In version 2.6.1, an empty map value is returned as AttributeValue(M={}), which correctly represents an empty map structure.
In version 3.1.0, the same empty map is returned as just AttributeValue(), which typically represents a null value rather than an empty map.
You're correct in your assessment that the 2.6.1 behavior more accurately represents the actual data structure. An empty map ("settings": { "M": {}}) should be represented as AttributeValue(M={}) rather than as a null value (AttributeValue()).
This discrepancy could cause issues in applications that rely on distinguishing between null values and empty maps. When working with empty collections in DynamoDB, it's important to note that while empty binary values are supported, and reading empty string values is supported, there are specific behaviors around empty values that may differ between local development environments and the live service.
If this inconsistency is causing problems in your application, you might need to add additional null checking or type verification in your code when working with potentially empty map values, especially if you plan to deploy to the live DynamoDB service.
Sources
Working with the .NET object persistence model and DynamoDB - Amazon DynamoDB
Working with the .NET document model in DynamoDB - Amazon DynamoDB
ExecuteStatement with Limit on DynamoDB Local returns wrong result set when using descending ordering | AWS re:Post
answered a year ago
Relevant content
asked 4 years ago
- AWS OFFICIALUpdated 2 years ago

I don't think that's expected.
The following test fails in 3.1.0 but succeeds in 2.6.1