Created
April 15, 2013 01:07
-
-
Save hminaya/5384988 to your computer and use it in GitHub Desktop.
get JSON api with C#
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Net; | |
using Newtonsoft.Json; | |
namespace api | |
{ | |
class MainClass | |
{ | |
public static void Main (string[] args) | |
{ | |
var url = "http://www.emplea.do/jobs.json"; | |
var json = new WebClient().DownloadString(url); | |
Job[] result = JsonConvert.DeserializeObject<Job[]>(json); | |
foreach (var j in result) { | |
Console.WriteLine(j.title); | |
Console.WriteLine(j.description); | |
//etc.. | |
} | |
} | |
} | |
class Job | |
{ | |
public string apply {get; set;} | |
public int category_id {get; set;} | |
public string company_email {get; set;} | |
public string company_name {get; set;} | |
public string company_url {get; set;} | |
public int days {get; set;} | |
public string description {get; set;} | |
public string location {get; set;} | |
public string title {get; set;} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment