Skip to content

True Myth / result / toJSON

Function: toJSON()

toJSON<T, E>(result): ResultJSON<T, E>

Create an Object representation of a Result instance.

Useful for serialization. JSON.stringify() uses it.

Type Parameters

T

T

E

E

Parameters

result

Result<T, E>

The value to convert to JSON

Returns

ResultJSON<T, E>

The JSON representation of the Result