In this tutorial we will learn step-by-step how to save and retrieve JSON data in a local folder of a Windows Store App.
In this tutorial we will learn step-by-step how to save and retrieve JSON data in a local folder of a Windows Store App.Use the following procedure to create a sample of saving and retrieving JSON data in local storage.Step 1 Right-click on the project and add the Nuget package and add the package of Json.NET. Step 2Let us assume that we need to store Student information in local storage. For that I have created a Student class as in the following:
Step 3Before saving the data we need to serialize the class into JSON. We will serliaze that using the JSON.net library. After serializing the object into JSON we will save the data in a local folder of Windows Store application.
S is the object of the class Student. We are reading the student properties from various textboxes.
In the above code snippet:
In these four steps the data can be saved in the local folder of the Windows Store application. Step 4To read the JSON data back we need to first read the data from local storage and then deserliaze that to an object from JSON. Reading the data is very simple.
In the preceding code snippet:
Using the preceding procedure you can save and retrieve data in a local folder of Windows Store application. I hope you find this article useful.
Universal Windows Platform - Complete Solution