Skip to content
Home » TypeError: (Integer) is not JSON serializable

TypeError: (Integer) is not JSON serializable

To solve TypeError: (Integer) is not JSON serializable when serializing JSON in Python error follow below methods.

ERROR LOG

TypeError: (Integer) is not JSON serializable

How to solve TypeError: (Integer) is not JSON serializable ?

Refer to the given methods to solve the issue.

Method 1:

The error occurs because of the datatype integer of type numpy.int64. But you can be used another.

Method 2 :

It appears that there is a problem with dumping numpy.int64 into a json string in Python 3, and the Python team is already discussing it.

json.dumps({'value': numpy.int64(42)}, default=convert)

Hope the above solution works.

Also read : AttributeError: ‘module’ object has no attribute ‘misc’

Tags: