Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
[react-native] wrapped AsyncStorage with JSON support
import { AsyncStorage } from 'react-native';
const JSONAsyncStorage = Object.assign({}, AsyncStorage, {
getItem() {
return AsyncStorage.getItem.apply(null, arguments).then((res) => JSON.parse(res));
setItem(key, value) {
return AsyncStorage.setItem(key, JSON.stringify(value))
export default JSONAsyncStorage;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment