effect-io-ai

Package: effect
Module: Inspectable

Inspectable.toJson

Converts a value to a JSON-serializable representation safely.

When to use

Use when you need a safe, JSON-serializable representation of a value without risking unhandled errors.

Details

This function attempts to extract JSON data from objects that implement the toJSON method, recursively processes arrays, and handles errors gracefully. For objects that don’t have a toJSON method, it applies redaction to protect sensitive information.

See

Signature

declare const toJson: (input: unknown) => unknown

Source

Since v4.0.0