Converts an object to a JSON-safe representation. This function ensures that
objects with custom toJSON or toString methods are properly serialized.
It also handles arrays and nested objects recursively.
Parameters
obj: any
The object to be converted to a JSON-safe representation.
Converts an object to a JSON-safe representation. This function ensures that objects with custom
toJSON
ortoString
methods are properly serialized. It also handles arrays and nested objects recursively.