Skip to content
Advertisement

Tag: asyncstorage

Parsing JSON object with AsyncStorage

I am basically trying to write and read a simple object. Writing: AsyncStorage.setItem(‘@Test’, JSON.stringify(newStudent)) Reading: console.log(JSON.parse(AsyncStorage.getItem(‘@Test’))) But im getting “Uncaught SyntaxError: Unexpected token o in JSON at position 1”. I Also tried console.log(AsyncStorage.getItem(‘@Test’).ID) But im getting “Undefined”. How can I parse the object? Answer There are two ways you can get your information from AsyncStorage First: Then you can simply

Advertisement