Skip to content

Instantly share code, notes, and snippets.

@atifaziz
Created January 15, 2009 08:33
Show Gist options
  • Save atifaziz/47321 to your computer and use it in GitHub Desktop.
Save atifaziz/47321 to your computer and use it in GitHub Desktop.
// http://groups.google.com/group/jayrock/t/4428c08b81d43485
using System;
using Jayrock.Json.Conversion;
class Program
{
static void Main()
{
const string json = @"{
'totalResults':1,
'startIndex':1,
'itemsPerPage':1,
'sorted':false,
'filtered':false,
'entry':[
{
'id':'myspace.com:26000010',
'nickname':'shaka',
'profileUrl':'http:\/\/www.myspace.com\/shakasarah',
'thumbnailUrl':'http:\/\/a229.ac-images.myspacecdn.com\/images01\/118\/s_3dcfafe8145a40fc46edacfebe7eaa94.jpg'
}
]
}";
var response = (MySpaceResponse) JsonConvert.Import(typeof(MySpaceResponse), json);
foreach (var person in response.entry)
Console.WriteLine(person.nickName);
}
}
public class MySpaceResponse
{
public int startIndex, totalResults, itemsPerPage;
public bool sorted, filtered;
public Person[] entry;
}
public class Person
{
public string fname { get; set; }
public string mname { get; set; }
public string lname { get; set; }
#region MySpace Properties
public string name { get; set; }
public string displayName { get; set; }
public string familyName { get; set; }
public string givenName { get; set; }
public string nickName { get; set; }
public string id { get; set; }
public string hasApp { get; set; }
public string[] emails { get; set; }
public DateTime dateOfBirth { get; set; }
public int age { get; set; }
#endregion
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment