def prepare_json(data: Any) -> Any:
    """Takes a data dict and transforms unserializable values to str for JSON.
    {1: PosixPath("/foo")} -> {"1": "/foo"}
    """
    unserializable_types = (Path,)
    if isinstance(data, dict):
        return_data = {}
        for key, val in data.items():
            value = str(val) if isinstance(val, unserializable_types) else val
            return_data[str(key)] = value
        return return_data
    elif isinstance(data, (list, tuple)):
        return_data = []
        for val in data:
            value = str(val) if isinstance(val, unserializable_types) else val
            return_data.append(value)
        return return_data
    return data
Takes a data dict and transforms unserializable values to str for JSON.
    {1: PosixPath("/foo")} -> {"1": "/foo"}
    
dynaconf/utils/__init__.py