I am using the LiveConnect sdk to get some user info.
After doing whatever is necessary for that, this is the result I'm getting:
{
"id": "123456789",
"name": "a b",
"first_name": "a",
"last_name": "b",
"link": "https://profile.live.com/",
"work": [],
"gender": null,
"emails": {
"preferred": "a@live.com",
"account": "a@live.com",
"personal": null,
"business": null
},
"addresses": {
"personal": {
"street": null,
"street_2": null,
"city": null,
"state": null,
"postal_code": null,
"region": null
},
"business": {
"street": null,
"street_2": null,
"city": null,
"state": null,
"postal_code": null,
"region": null
}
},
"locale": "en_US",
"updated_time": "2013-10-10T08:41:14+0000"
}
I need to get the "account"
inside "emails"
.
First, when I got this string I did the following:
public Dictionary<string, object> userData = new Dictionary<string, object>();
userData = deserializeJsonObject(<the string above>);
private Dictionary<string, object> deserializeJsonObject(string json)
{
var jss = new JavaScriptSerializer();
var d = jss.Deserialize<Dictionary<string, object>>(json);
return d;
}
Now, in order to get the account email, I was going to do something like:
string email = userData["emails"]["account"];
but since this is a string, object dictionary, I get an error that it's not possible because userData["emails"] is an object.
How can I get the data?