Replace `toObject` with `toJSON`