def default(self, obj):
if isinstance(obj, np.ndarray):<EOL><INDENT>return obj.tolist()<EOL><DEDENT>elif isinstance(obj, np.generic):<EOL><INDENT>return np.asscalar(obj)<EOL><DEDENT>return json.JSONEncoder(self, obj)<EOL>
If input object is an ndarray it will be converted into a list