Allow attributes to override their json serizlization by providing `toJSON`

The primary use case I see for this is helping serialize nested models.

For example, I work with an API that takes and returns a complete hierarchy of our data, but I need to work with each node as individual objects with their own methods. So I use collection instances as attributes to manage child nodes. When I'm ready to sync, this change does all the work of converting my data back to a hierarchy that works with our API.

It's a general enough change that there are probably other use cases.

Tests pass on
- Chrome 32 (OS X 10.9.1)
- Firefox 27 (OS X 10.9.1)
- Safari 7 (OS X 10.9.1)
- IE 8 (Windows XP)