Parse JSON in Windows 8 Metro UI Apps

Introduction

Code for parsing JSON in Windows 8 is no more then 4 lines. If you follow this procedure I assure you that you will be okay with it.

Step 1

For parsing a JSON API you need to find a JSON API that returns JSON.

Step 2

Use the JSON end point link to parse JSON and use data.

Step 3

For parsing JSON you need to download a Nuget package that is for JSON.NET often called "NewtonSoft.JSON". You may download it from Codeplex or you may use Nuget to get the package.

JSON

Step 4

Extract a class from json2csharp by entering the URL of the API and use it in your project.

Step 5

Make a method of async void type and make an object of HTTP client and use the code below.

cs code

Step 6

Now use the JSON.NET API to parse JSON data.

  1. var rootObject = JsonConvert.DeserializeObject<RootObject>(result);  
Step 7

Use the rootObject as you like, you may bind it or you may use it for any purpose you like as I have used it in a textblock in a scrollviewer.

Step 7 

fifa

I hope you find this article interesting, stay in touch.

Personal Blog: Blend Unleashed.


Similar Articles