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.