Function toJSON

Create an Object representation of a Result instance.

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