问题
I would like to know how to use Ionic Storage to store Json Object with Ionic 3. I am finding it difficult as there are no examples for the ionic 3 and i am stuck. Nothing on the net seems to be updated. A supporting example for Ionic Storage would be of great use. Thank you in advance.
回答1:
Yes, you can store JSON
objects in Ionic storage.
let your_json_object = { "name":"John", "age":30, "car":null };
// set a key/value
storage.set('my-json', your_json_object);
// to get a key/value pair
storage.get('my-json').then((val) => {
console.log('Your json is', val);
});
来源:https://stackoverflow.com/questions/46217643/how-to-use-ionic-storage-to-store-json-object-from-api-with-ionic-3