Deep-clone value into a JSON-safe form: circular references are replaced with the string
'[Circular]' and BigInts are stringified. Functions / undefined are dropped exactly as
JSON.stringify would drop them. Returns null if the value isn't representable at all.
Useful for capturing arbitrary third-party objects (e.g. an SDK response) into an audit blob
that must survive a later JSON.stringify without throwing on a circular reference.
The return is typed unknown (not any) so callers must narrow before use; assigning the
result directly into a Record<string, any> blob is fine.
Deep-clone
valueinto a JSON-safe form: circular references are replaced with the string'[Circular]'and BigInts are stringified. Functions / undefined are dropped exactly asJSON.stringifywould drop them. Returnsnullif the value isn't representable at all.Useful for capturing arbitrary third-party objects (e.g. an SDK response) into an audit blob that must survive a later
JSON.stringifywithout throwing on a circular reference.The return is typed
unknown(notany) so callers must narrow before use; assigning the result directly into aRecord<string, any>blob is fine.