Facebook Graph API:结果为数组或 json 对象

发布于 2024-10-13 23:06:27 字数 1112 浏览 3 评论 0原文

我对图 api 结果之间有点困惑。任何人都可以解释当我们通过图 api 获取数据时 facebook 使用哪种默认对象方法。具有用于访问 json 对象或数组对象中的数据的任何应用程序帐户设置,因为有时我发现用户数据是加密的,有时是未加密的。 我通过 facebook graph api 通过两种方式找到了用户电子邮件 ID。 第一个是:

{
   "id": "100001114785800",
   "name": "Stella Jackson",
   "first_name": "Stella",
   "last_name": "Jackson",
   "link": "http://www.facebook.com/profile.php?id=100001114785800",
   "birthday": "04/16/1987",
   "gender": "female",
   "email": "[email protected]",
   "timezone": 5.5,
   "locale": "en_US",
   "updated_time": "2010-10-08T13:26:10+0000"
}

第二个是:

{
   "id": "100001114785800",
   "name": "Stella Jackson",
   "first_name": "Stella",
   "last_name": "Jackson",
   "link": "http://www.facebook.com/profile.php?id=100001114785800",
   "birthday": "04/16/1987",
   "gender": "female",
   "email": "stella_ja\u0040live.com",
   "timezone": 5.5,
   "locale": "en_US",
   "updated_time": "2010-10-08T13:26:10+0000"
}

有什么想法吗?

谢谢

I have little bit confuse between graph api result.Can any one explain which default object method is facebook using when we fetch data via graph api. Have any application account setting for access data in json object or in array object, because some time i found user data in encrypted and some time non encrypted.
I found user email id in two way from facebook graph api.
One is:

{
   "id": "100001114785800",
   "name": "Stella Jackson",
   "first_name": "Stella",
   "last_name": "Jackson",
   "link": "http://www.facebook.com/profile.php?id=100001114785800",
   "birthday": "04/16/1987",
   "gender": "female",
   "email": "[email protected]",
   "timezone": 5.5,
   "locale": "en_US",
   "updated_time": "2010-10-08T13:26:10+0000"
}

And second one is:

{
   "id": "100001114785800",
   "name": "Stella Jackson",
   "first_name": "Stella",
   "last_name": "Jackson",
   "link": "http://www.facebook.com/profile.php?id=100001114785800",
   "birthday": "04/16/1987",
   "gender": "female",
   "email": "stella_ja\u0040live.com",
   "timezone": 5.5,
   "locale": "en_US",
   "updated_time": "2010-10-08T13:26:10+0000"
}

Have any idea?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

痞味浪人 2024-10-20 23:06:27

@Vik我想做同样的事情,收集数组中的帖子信息,如果它有效的话试试这个。

   if (response.authResponse) {
    var accessToken =    response.authResponse.accessToken;
        //var UserInfo = document.getElementById('UserInfo'); 
        FB.api('/' + info.id + '/feed?access_token=' + accessToken, 
                    { limit: 20 },function(result) {

        UserInfo.innerHTML = "Welcome, " +  result.id + "!";
        alert('Message: ' + result.id);
            });
                                }  

@Vik i want to do the same thing, collect post info in array, try this if it work than see..

   if (response.authResponse) {
    var accessToken =    response.authResponse.accessToken;
        //var UserInfo = document.getElementById('UserInfo'); 
        FB.api('/' + info.id + '/feed?access_token=' + accessToken, 
                    { limit: 20 },function(result) {

        UserInfo.innerHTML = "Welcome, " +  result.id + "!";
        alert('Message: ' + result.id);
            });
                                }  
猥琐帝 2024-10-20 23:06:27

“\u0040”与“@”符号的混淆或 Unicode 形式相同。大多数解析器可以将其转换为原始符号。

检查这里以获取 Unicode 字符集列表。

http://www.alanwood.net/demos/ansi.html

The '\u0040' is same as obfuscated or Unicode form of '@' symbol. Most Parsers can convert that to the original symbol.

Check this for list of Unicode character set.

http://www.alanwood.net/demos/ansi.html

梦醒灬来后我 2024-10-20 23:06:27

最简单的方法是获取电子邮件字符串并执行类似的操作(目标 c):

NSString *email = @"stella_ja\u0040live.com"; // or whatever you use to get it
email = [NSString stringByReplacingOccurencesOfString:@"\u0040" withString:@"@"];

换句话说,使用字符串方法将“\u0040”替换为“@”。

The easiest way would be to take the email string and do something like this (objective c):

NSString *email = @"stella_ja\u0040live.com"; // or whatever you use to get it
email = [NSString stringByReplacingOccurencesOfString:@"\u0040" withString:@"@"];

So in other words, use string methods to replace "\u0040" with "@".

多彩岁月 2024-10-20 23:06:27

您可以简单地将 \u0040 替换为 @,但在此替换期间,编译器会将 "\" 视为转义序列,并会跳过此序列而不进行更改。

你会像下面这样做什么:

NSString *strEmail = @"stella_ja\u0040live.com";
[strEmail stringByReplacingOccurrencesOfString:@"\\u0040" withString:@"@"];
NSLog(@"strEmail: %@", strEmail);

you can simply replace \u0040 with @ but during this replace compiler will consider "\" as escape sequence and will skip this without making changes.

What you do like this below:

NSString *strEmail = @"stella_ja\u0040live.com";
[strEmail stringByReplacingOccurrencesOfString:@"\\u0040" withString:@"@"];
NSLog(@"strEmail: %@", strEmail);
你又不是我 2024-10-20 23:06:27

使用这个来获取ios的电子邮件的字典n值

FbGraphResponse *fb_graph_response = [fbGraph doGraphGet:@"me" withGetVars:nil];
NSLog(@"getMeButtonPressed:  %@", fb_graph_response.htmlResponse);
NSDictionary *dictionary=[fb_graph_response.htmlResponse JSONValue];
NSLog(@"%@",[dictionary valueForKey:@"email"]);

希望它对你有帮助。

Use this to get the dictionary n value of email for ios

FbGraphResponse *fb_graph_response = [fbGraph doGraphGet:@"me" withGetVars:nil];
NSLog(@"getMeButtonPressed:  %@", fb_graph_response.htmlResponse);
NSDictionary *dictionary=[fb_graph_response.htmlResponse JSONValue];
NSLog(@"%@",[dictionary valueForKey:@"email"]);

Hope it helps you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文