def default_noraise(o):
    "\n    Try to convert some extra types during JSON serialization.\n\n    This is intended to be passed to json.dump or json.dumps as the 'default' arg.  It will\n    attempt to convert values if possible, but if no conversion works, will return\n    'unserializable object (<type>)' instead of raising a TypeError.\n\n    Parameters\n    ----------\n    o : object\n        The object to be converted.\n\n    Returns\n    -------\n    object\n        The converted object.\n    "
    if isinstance(o, _container_classes):
        return [default_noraise(item) for item in o]
    elif isinstance(o, dict):
        s_key = [make_serializable_key(item) for item in o.keys()]
        s_val = [default_noraise(item) for item in o.values()]
        return dict(zip(s_key, s_val))
    elif isinstance(o, np.ndarray):
        return o.tolist()
    elif isinstance(o, np.number):
        return o.item()
    elif isinstance(o, (str, float, int)):
        return o
    elif (isinstance(o, bool) or isinstance(o, complex)):
        return str(o)
    elif hasattr(o, '__dict__'):
        return o.__class__.__name__
    elif (o is None):
        return None
    else:
        return f'unserializable object ({type(o).__name__})'
Try to convert some extra types during JSON serialization.

This is intended to be passed to json.dump or json.dumps as the 'default' arg.  It will
attempt to convert values if possible, but if no conversion works, will return
'unserializable object (<type>)' instead of raising a TypeError.

Parameters
----------
o : object
    The object to be converted.

Returns
-------
object
    The converted object.
def default_noraise(o):
    "\n    Try to convert some extra types during JSON serialization.\n\n    This is intended to be passed to json.dump or json.dumps as the 'default' arg.  It will\n    attempt to convert values if possible, but if no conversion works, will return\n    'unserializable object (<type>)' instead of raising a TypeError.\n\n    Parameters\n    ----------\n    o : object\n        The object to be converted.\n\n    Returns\n    -------\n    object\n        The converted object.\n    "
    if isinstance(o, _container_classes):
        return [default_noraise(item) for item in o]
    elif isinstance(o, dict):
        s_key = [make_serializable_key(item) for item in o.keys()]
        s_val = [default_noraise(item) for item in o.values()]
        return dict(zip(s_key, s_val))
    elif isinstance(o, np.ndarray):
        return o.tolist()
    elif isinstance(o, np.number):
        return o.item()
    elif isinstance(o, (str, float, int)):
        return o
    elif (isinstance(o, bool) or isinstance(o, complex)):
        return str(o)
    elif hasattr(o, '__dict__'):
        return o.__class__.__name__
    elif (o is None):
        return None
    else:
        return f'unserializable object ({type(o).__name__})'