Function: toJSON() 
toJSON<
T,E>(result):Serialized<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 
Serialized<T, E>
The JSON representation of the Result