Json deserialization example RRS feed

  • Question

  • Are there any examples of using HttpClient and deserializing json? Seems like a core use case. I've always used Json.Net in the past so I'm trying to do something similar. I looked at the Json namespace and now I'm looking at DataContractSerializer.
    Tuesday, September 20, 2011 2:09 AM


All replies

  • You can check out the project I'm working on @ https://github.com/seiggy/reddit-Metro/

    Both of the code behind pages for the two XAML pages are deserializing JSON responses into objects. Pretty straight forward.

    Tuesday, September 20, 2011 2:17 AM
  • Lol (actual lol). That is the exact app I'm working on. 
    Tuesday, September 20, 2011 2:38 AM
  • haha, fantastic. Feel free to join efforts. I've made quite a bit of progress if you want to check it out. I'm fighting a few bugs at the moment, and fighting the fact that there's no flyout in the XAML/C# controls. Trying to think of the best way to have the user login to their reddit account
    Tuesday, September 20, 2011 2:46 AM
  • Just saw that there is no flyout in another post. I was going down that same path. 
    Tuesday, September 20, 2011 2:49 AM
  • BTW - have you tried Json.Net? I've heard from others it works in Metro style apps but I have not tried it myself.


    Tuesday, September 20, 2011 2:51 AM
  • I figured it wouldn't work and didn't check it. Shame on me. 


    DataContractJsonSerializer works though.  

    Tuesday, September 20, 2011 2:55 AM
  • I started to try installing Json.Net, then realized that nuget wasn't working with VS11 yet.  I was stumbling around the API docs for some other stuff and found the native JSON serialization support, wich with data contracts works just fine for me. Sure, my code would be a bit cleaner with JSON.net as I could build fewer objects, but that's more the fault of the json service I'm calling for having so many nested objects!
    Tuesday, September 20, 2011 2:57 AM