I am trying to save an array in localStorage but it contains functions (called promise) in an object of the array, but the problem appears when I convert array to string using JSON.stringify, apparently all functions are removed and when I parse string to JSON Object it comes without methods.
/* Example code */
var storage = {
getListUsers: function(){
return {
name: 'name',
age: 'age'
}
},
active: true,
data: []
}
var convert = JSON.stringify(storage);
localStorage.setItem('data', convert);
Best regards.
JSON.stringify, thereplacerfunction - and the optional second argument toJSON.parse, thereviverfunction - though it's going to be a bit of a challengestorage.dataarray? (I.e., promises not actually shown in the question?)