I am trying to fetch Facebook profile data through Graph API. I am using Facebook SDK in MVC application. Using the following code returns dynamic result.
dynamic myInfo = await fb.GetTaskAsync("v2.8/me?fields=first_name,last_name,link,locale,email,name,birthday,gender,location,age_range");
var facebookProfile = new FacebookProfileViewModel()
{
FirstName = myInfo.first_name,
LastName = myInfo.last_name,
LinkUrl = myInfo.link,
Locale = myInfo.locale };
I am getting the data from facebook like this -
[{"Key":"first_name","Value":"John"},{"Key":"last_name","Value":"Doe"},{"Key":"link","Value":"https://www.facebook.com/app_scoped_user_id/4327693/"}]
I am getting the following error -
Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Cannot implicitly convert type 'Facebook.JsonObject' to 'string'