Revert "fix toJSON() method"

This reverts commit d846347693ef8e9146e0a32ba8993fae126c4bbf.