Hello, I am currently attempting to update a specific part of an object stored in Ionic storage. The current data in the Storage looks like this:
key : object
value : {a: "1", b: "2", c: "3"}
To modify one of the values to 10, I created the following function:
modifyObject() {
this.storage.get('object').then(valueStr => {
let value = JSON.parse(valueStr);
// Updating the desired property
value.a = '10';
// Saving the entire modified data again
this.storage.set('object', JSON.stringify(value));
});
}
However, when executing this function, an error occurred as follows:
ERROR Error: Uncaught (in promise): SyntaxError: Unexpected token o in JSON at position 1
SyntaxError: Unexpected token o in JSON at position 1