Error: dynamodb number_value cannot be converted to string

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.
Other Common DynamoDB Errors (with Solutions)
- error retrieving dynamodb table item serializationexception
- DynamoDB scan filter expression not working
- missing required key 'key' in params dynamodb
- DynamoDB Error All Attributes Must Be Indexed
- com amazonaws services dynamodbv2 model resourcenotfoundexception
- DynamoDB Not Supported Requires @DynamoDBTyped Or @DynamoDBTypeConverted
- dynamodb table not exists
- DynamoDB local error unable to access JAR file dynamodblocal.jar
- DynamoDB is not showing all columns
- is not authorized to perform dynamodb:* on resource
- dynamodb query is null
- requested resource not found aws dynamodb
- error updating dynamodb table time to live
- dynamodb global secondary index does not project
- dynamodb put function not working
Dynobase is a Professional GUI Client for DynamoDB
Start your 7-day free trial today
Product Features
DynamoDB Tools
- SSH GUI Client
- Chat With Cloud
- MongoDB GUI Client
- AWS Cost Monitoring
- DynamoDB Query Builder
- DynamoDB Code Examples
- DynamoDB Node.js Queries
- DynamoDB JSON Converter
- DynamoDB UUID Generator
- DynamoDB Local Admin GUI
- DynamoDB Pricing Calculator
- DynamoDB Single-Table Design
- Best DynamoDB GUI Clients
- Dynobase vs DynoTable