Skip to content

Instantly share code, notes, and snippets.

@adamsteinert
Created March 17, 2014 20:02
Show Gist options
  • Save adamsteinert/9607056 to your computer and use it in GitHub Desktop.
Save adamsteinert/9607056 to your computer and use it in GitHub Desktop.
Get a ResponseBase<T> from a web service via JSON.
using System.Net;
using Newtonsoft.Json.Linq;
//...
using (var w = new WebClient())
{
var json_data = string.Empty;
var fullUrl = commandUrl + key;
json_data = w.DownloadString(fullUrl);
var package = JObject.Parse(json_data).ToObject<ResponseBase<ClientConfigPackage>>();
if(!package.Success)
this.YsLog(package.Error);
return package;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment