1. Glenn Ruysschaert's Avatar
    Hello, I found that a lot of the code necessary to communicate with a JSON API is always the same. So I compiled the code I frequently use into a NuGet package and released it.

    It is the second version, so it might be buggy and doesnt have that many features yet. Plus it's my very first NuGet package I made, and only spent about 3 hours on it (so it's kind of a trial). I decided to release it already anyway, so it might help others code faster.

    The usage is really simple, for example to get the word of the day on Urban Dictionary I have this class:
    public class WordOfTheDay
        public string word { get; set; }
        public string meaning { get; set; }
    Then all I need to do is use this line of code, and I will get the word of the day in the class I gave.
    WordOfTheDay wotd = await JsonHttp.Get<WordOfTheDay>(new Uri("http://urban-word-of-the-day.herokuapp.com/today"));
    That's it! No more messing with HttpClient, handlers, ... As for now it obviously only supports basic functionality, but I'm open to requests.

    It's possible to add some extra options:
    JsonHttp.Options options = new JsonHttp.Options()
        AllowAutoRedirect = true,
        DefaultRequestHeaders = new Dictionary<string, string>(),
        AddMediaTypeWithQualityHeadersJson = true,
        UseLocationHeaderForRedirects = true
    WordOfTheDay wotd = await JsonHttp.Get<WordOfTheDay>(new Uri("http://urban-word-of-the-day.herokuapp.com/today"), options);
    For POST/PUT you can also let a class be automatically converted to JSON and sent with your request
    WordOfTheDay toPost = new WordOfTheDay()
         word = "test",
         meaning = "something"
     WordOfTheDay wotdPost = await JsonHttp.Post<WordOfTheDay>(new Uri(""), toPost, options);
    You can try it out here (or look for JsonHttp).
    Source code and documentation here on GitHub
    vander09 likes this.
    04-19-2016 03:46 AM
  2. owensdj's Avatar
    Looks like JsonHttp is going to be really good.
    04-19-2016 10:10 AM
  3. Glenn Ruysschaert's Avatar
    Thanks, I hope it will be
    04-21-2016 05:05 AM

Similar Threads

  1. Replies: 5
    Last Post: 04-20-2016, 02:19 AM
  2. Windows Camera app for Mobile: Issues with Living Images, any advice?
    By Shanmuga Subramanian in forum Windows 10
    Replies: 1
    Last Post: 04-19-2016, 03:12 AM
  3. App for google-drive?
    By Windows Central Question in forum Ask a Question
    Replies: 1
    Last Post: 04-19-2016, 01:21 AM
  4. Beta impressions: Does Battleborn make the case for the first-person MOBA?
    By WindowsCentral.com in forum Windows Central News Discussion & Contests
    Replies: 0
    Last Post: 04-18-2016, 04:42 PM