dynobase-icon
Dynobase

Error: dynamodb number_value cannot be converted to string

Rafal Wilinski

Answered by Rafal Wilinski

Last updated: October 23rd, 2026

Solution

“Number value cannot be converted to string” often means a low-level DynamoDB Number was supplied as a JSON number instead of its required numeric string, or a mapper expected String while the stored value is Number. Identify the client layer before converting the data.

import boto3

db = boto3.client("dynamodb", region_name="us-west-2")
db.put_item(TableName="Orders", Item={
    "id": {"S": "12345"},
    "quantity": {"N": "12"},
})

Here {"N":"12"} stores a Number. {"S":"12"} stores a String and changes comparison and arithmetic behavior. The boto3 Table resource instead accepts {"id":"12345","quantity":12} and performs serialization.

Check the declared type for table and index keys. Non-key fields can vary between items, but your application model may impose a stricter type. If old records contain mixed types, migrate them deliberately or handle both in the reader. Do not stringify all numbers to suppress a serializer error.

See numeric and string types and AWS documentation.

Dynobase is a Professional GUI Client for DynamoDB

Start your 7-day free trial today

Product Features

Download
/
Changelog
/
Pricing
/
Member Portal
/
Privacy
/
EULA
/
Twitter
© 2026 Dynobase
+
Still using AWS DynamoDB Console?
Try Dynobase to accelerate your DynamoDB workflow. Start your 7-day free trial today.