Easisest way to persist JSON array


#1

What should be the easiest way to persist JSON array ?


#2
const appSettings = require("application-settings");
appSettings.setString("myArray", JSON.stringify(myArray));

And to get it back

myArray = JSON.parse(appSettings.getString("myArray" , "[]")); //second param is default value

You can read more about it here
https://docs.nativescript.org/cookbook/application-settings


#3

Wooow. I didn’t even think for a second about this. Thank you :slight_smile: