The convertEmptyValues option in the Amazon DynamoDb DocumentClient when set to true, should automatically convert empty strings, blobs, and sets to null.
https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB/Converter.html
For the below code,
const aKey = datetime + " - " + aRandom
const info = {
attr1 : "derf",
attr2 : ''
}
AWS.config.credentials.get(function(){
ddbdoc_get('newTable',aKey,"shorn",info)
});
function ddbdoc_get(tableName, hashId, sortID , info) {
var docClient = new AWS.DynamoDB.DocumentClient({ convertEmptyValues : true});
var params = {
TableName: tableName,
Item : { id: hashId,
name : sortID,
...info
},
};
docClient.put(params, function(err, data) {
if (err) {
console.log("Error", err);
} else {
console.log("Success", data.Item);
}
});
}
In the database, attr3 is being set in dynamoDB database as true and not as null( the item after 'derf')

how to set empty string to null in DynamoDB?