Martin Rodrigo Morales
๐Ÿš€ Initial release: Advanced Transformer Sentiment Analysis
5b6f681
raw
history blame contribute delete
403 Bytes
import json
from typing import Any
def to_json_serializable(obj: Any) -> Any:
"""Try to convert common non-serializable objects into JSON-serializable forms.
For now this is a simple wrapper around json.dumps for known simple cases.
"""
try:
json.dumps(obj)
return obj
except TypeError:
# Fallback: convert to string representation
return str(obj)