Re:Revesiting Backbone.js View Rendering
by papercrane on Wednesday March 20, 2013 @11:36AM
(#5407870)
You're probably thinking of `JSON.stringify()`. `model.toJSON()` just returns a clone of the models attributes object.
[ Parent
| on HN ]
So `model.toJSON()` isn't supposed to return a JSON-compatible data structure ?
Re:Revesiting Backbone.js View Rendering
by papercrane on Wednesday March 20, 2013 @12:38PM
(#5408357)
It's supposed to return an object that is suitable for turning into JSON, but it won't convert any of items members. JSON.stringify relies on the toJSON functions of the members to serialize themselves.