I just created a function that return JSON.stringify like this:
JSON.stringify = function (item, replacer, space) {
return JSON.stringify(item, replacer, space);
}
and it causes all these errors on angularjs: click here
The reason I want to override the function is because I want to create a property in objects that tells the JSON to ignore a field, like this:
JSON.stringify = function (item, replacer, space) {
if (angular.isObject(item)) {
var newItem = angular.copy(item);
var ignores = item.jsonIgnore || [];
ignores.forEach(prop => {
delete newItem[prop];
});
return JSON.stringify(newItem, replacer, space);
}
return JSON.stringify(item, replacer, space);
}