python/ray/serve/pipeline/json_serde.py
def convert_to_json_safe_obj(obj: Any, *, err_key: str) -> Any:
    """Converts the provided object into a JSON-safe version of it.

    The returned object can safely be `json.dumps`'d to a string.

    Uses the Ray Serve encoder to serialize special objects such as
    ServeHandles and DAGHandles.

    Raises: TypeError if the object contains fields that cannot be
    JSON-serialized.
    """
    try:
        return json.loads(json.dumps(obj, cls=DAGNodeEncoder))
    except Exception as e:
        raise TypeError(
            "All provided fields must be JSON-serializable to build the "
            f"Serve app. Failed while serializing {err_key}:\n{e}"
        )
Converts the provided object into a JSON-safe version of it.

    The returned object can safely be `json.dumps`'d to a string.

    Uses the Ray Serve encoder to serialize special objects such as
    ServeHandles and DAGHandles.

    Raises: TypeError if the object contains fields that cannot be
    JSON-serialized.
    
Converts the provided object into a JSON-safe version of it.
The returned object can safely be `json.dumps`'d to a string.

Uses the Ray Serve encoder to serialize special objects such as
ServeHandles and DAGHandles.

TypeError if the object contains fields that cannot be
JSON-serialized.
Converts the provided object into a JSON - safe version of it . The returned object can safely be ` json . dumps ` ' d to a string . Uses the Ray Serve encoder to serialize special objects such as ServeHandles and DAGHandles . TypeError if the object contains fields that cannot be JSON - serialized .
def convert_to_json_safe_obj(obj: Any, *, err_key: str) -> Any:
    try:
        return json.loads(json.dumps(obj, cls=DAGNodeEncoder))
    except Exception as e:
        raise TypeError(
            "All provided fields must be JSON-serializable to build the "
            f"Serve app. Failed while serializing {err_key}:\n{e}"
        )
def convert_to_json_safe_obj ( obj : Any , * , err_key : str ) -> Any : try : return json . loads ( json . dumps ( obj , cls = DAGNodeEncoder ) ) except Exception as e : raise TypeError ( "All provided fields must be JSON-serializable to build the " f"Serve app. Failed while serializing {err_key}:\n{e}" )
Converts the provided object into a JSON-safe version of it.
Converts the provided object into a JSON - safe version of it .
"""Converts the provided object into a JSON-safe version of it.

    The returned object can safely be `json.dumps`'d to a string.

    Uses the Ray Serve encoder to serialize special objects such as
    ServeHandles and DAGHandles.

    Raises: TypeError if the object contains fields that cannot be
    JSON-serialized.
    """
obj
Any
err_key
str