langchain_core.tracers.stdout
.try_json_stringify¶
- langchain_core.tracers.stdout.try_json_stringify(obj: Any, fallback: str) str [source]¶
Try to stringify an object to JSON. :param obj: Object to stringify. :param fallback: Fallback string to return if the object cannot be stringified.
- Returns
A JSON string if the object can be stringified, otherwise the fallback string.
- Parameters
obj (Any) –
fallback (str) –
- Return type
str