I am having real hard time trying to deserialize this JSON string where in i want to extract the user's work_history, current_location and education_history
My string is a as follows:
{"uid":56354665,"name":"ABCBGFF","pic_square":"https:\/\/fbcdn-profile-a.akamaihd.net\/hprofile-ak-snc4\/370835_520310824_553662476_q.jpg","affiliations":[],"birthday_date":"12\/03\/1986","sex":"female","relationship_status":null,"current_location":{"city":"Delhi","state":"Delhi","country":"India","zip":"","id":102161913158207,"name":"Delhi, India"},"education_history":[{"name":"I E T , Alwar (Raj.)","year":2007,"concentrations":[],"school_type":"College"},{"name":"Institute of Engineering and Technology, Alwar","concentrations":[],"school_type":"College"}], "work_history":[{"location":{"city":"","state":""},"company_name":"Defence Research & Development Organisation (DRDO)","description":"","start_date":"0000-00","end_date":"0000-00"}],"contact_email":null} ,
{"uid":522036860,"name":"ABCPRE","pic_square":"https:\/\/fbcdn-profile-a.akamaihd.net\/hprofile-ak-snc4\/174460_522036860_1780781144_q.jpg","affiliations":[],"birthday_date":"12\/07","sex":"female","relationship_status":null,"current_location":{"city":"New Delhi","state":"Delhi","country":"India","zip":"","id":106517799384578,"name":"New Delhi, India"},"education_history":[{"name":"Amity University","concentrations":["Event Management","Journalism & Mass Communication","Advertising"],"school_type":"College"},{"name":"Amity University","year":2009,"concentrations":["Journalism and Mass Communication"],"school_type":"College"},{"name":"Amity School of Communication","concentrations":[],"school_type":"College"}],"work_history":[{"location":{"city":"","state":""},"company_name":"- \/ as a photographer! :D","description":"","start_date":"0000-00"},{"location":{"city":"","state":""},"company_name":"Infinity Advertising Services Pvt. Ltd.","description":"","start_date":"0000-00","end_date":"0000-00"}],"contact_email":null }
My Class is as follows :
public class Data
{
public List<CurrentLocation> current_location { get; set; }
public List<WorkHistory> work_history { get; set; }
public List<EducationHistory> education_history { get; set; }
}
public class EducationHistory
{
public string name { get; set; }
public int? year { get; set; }
public string school_type { get; set; }
}
public class WorkHistory
{
public string company_name { get; set; }
public Location location { get; set; }
}
public class CurrentLocation
{
public string city { get; set; }
public string state { get; set; }
public string country { get; set; }
}
public class Location
{
public string city { get; set; }
public string state { get; set; }
}
How do i retreive and display values currently its showing null values
when i try this :
Data soap = JsonConvert.DeserializeObject<Data>(ser);
Member
4 Points
31 Posts
How to deserialize a JSON string from facebook in asp.net?
Feb 19, 2012 01:31 AM|vinikatyal|LINK
I am having real hard time trying to deserialize this JSON string where in i want to extract the user's work_history, current_location and education_history
My string is a as follows:
How do i retreive and display values currently its showing null values
Member
15 Points
21 Posts
Re: How to deserialize a JSON string from facebook in asp.net?
Mar 07, 2012 02:09 AM|Sachin303|LINK
HI,
You can call overloaded method of DeserializedObject as
serialization Json