Teemu Tapanila bio photo

Teemu Tapanila

Microsoft Azure MVP and Windows Phone developer

Email Twitter Facebook Google+ LinkedIn Github Stackoverflow

These days there exists huge amount of API’s. One of the most used formatting is JSON. Consuming JSON with .net is kinda easily but to get full support of intellisense require developer to create classes that match the data provided. Jonathan Keith published nice tool called json2csharp which you can use for that. I will show you how to consume JSON API of my blog.

  1. Create a new Blank Metro App

    Creating Blank Metro Project Json

  2. Open browser and browse to your json source

    Tapanila Blog JSON

  3. Open another tab and browse to  http://json2csharp.com/, copy-paste all of the json and click Generate

    Json to CSharp

  4. Create a new class in visual studio and name it helper.cs

    Create new class

  5. On helper.cs replace class helper with all of the code from json2chsarp page

    Helper Class

  6. Open NuGet manager and install Json.NET

    Nuget JSON.net

  7. Edit MainPage.xaml.cs

That is it. You are done!

Now you can start consuming json API without much effort.