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