Should call 'toJSON' if it is defined on the object being stringified.

Call `toJSON` if it is defined as a property on the object and is a function.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#toJSON_behavior

I'm currently using this module and have had to do a workaround to get this behaviour.