I want to convert a object mixed with Backbone.Events into Json, but if I use JSON.stringify(), I get a error : "TypeError: cyclic object value".
My code :
var object_event = _.extend({
attr1: 'value1',
attr2: 'value2',
}, Backbone.Events);
var view = new Backbone.View();
view.listenTo(object_event, 'anEvent', function () {
JSON.stringify(object_event);
});
object_event.trigger('anEvent');
//the error occured
I saw in here : Serializing object that contains cyclic object value, that using the second parameter of JSON.stringify like it is describe is not useable on event objects.