Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

TypeError: Object of type uint32 is not JSON serializable

# It seems like there may be a issue to dump numpy.int64 into json string in Python 3.
# the generic solution: 

def convert(o):
    if isinstance(o, np.generic): return o.item()  
    raise TypeError

json.dumps({'value': numpy.int64(42)}, default=convert)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Object #type #JSON #serializable
ADD COMMENT
Topic
Name
9+2 =