One of the attributes of my model is a backbone collection.
When I print out the model, everything appears to be fine, including the collection.
However, when I use the toJSON() method on the collection and output it, the entire collection object is displayed as JSON.
For example, the following code:
console.log('about to sync', model);
console.log('files', model.attributes.files.toJSON());
Results in this output:
https://i.sstatic.net/qHZqJ.jpg
Although the collection is correctly stored in the model, calling toJSON includes all functions in the object along with the models instead of just returning "an array containing the attributes hash of each model in the collection".