I have a JSON response from Facebook Graph API, that looks like this:
{
"name": "XXXXXX YYYYYYY",
"username": "XXXXXX.YYYYYYY",
"email": "[email protected]",
"location": {
"id": "110507998976900",
"name": "Someplace, Somestate"
},
"work": [
{
"employer": {
"id": "4647647894784698",
"name": "Some Employer"
},
"location": {
"id": "7489468976968988",
"name": "Someplace, Somestate"
},
"position": {
"id": "4876498697859795",
"name": "Boss"
},
"start_date": "0000-00"
}
],
"id": "1895789769789679",
"picture": {
"data": {
"url": "https://fbcdn-aaaaaaa.net/aaaaaaaa/458768_484784776868_4875876876_q.jpg",
"is_silhouette": false
}
}
I inherited code that deserializes the response, but I added the more complex fields like location, work and picture into the request, and now the JSON deserializer throws an error.
I have a wrapper class that uses DataContractJsonSerializer.ReadObject(), and a data contract class that looks like this:
[DataContract]
public class FacebookMe
{
private string fbId;
[DataMember]
public string id
{
get { return fbId; }
set { fbId = value; }
}
...
I tried adding the 'work' field first as a string, (that's when the errors started) then as a Dictionary. So far I've had no luck and I'm running out of ideas. Any suggestions?