分析Facebook Json的结果 [英] Parsing Facebook Json results

查看:221
本文介绍了分析Facebook Json的结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用以下代码来解析Facebook API的响应,而且我会收到一个奇怪的错误...下面是代码和错误...任何想法都非常感谢!

I'm trying to use the following code to parse a response from the Facebook API, and I get a strange error... below is the code and error... Any thoughts are greatly appreciated!

代码链接:如何获得最受欢迎的Facebook发布在R

我得到的错误是:

Error in myposts[[1]]$paging$"next" : $ operator is invalid for atomic vectors

这是数据的样子:

tail(myposts[[1]])

结果:

$paging

previous 
"https://graph.facebook.com/74133697733/posts?access_token=###token###&limit=25&since=1361736602&__previous=1" 

next

"https://graph.facebook.com/74133697733/posts?access_token=###token###&limit=25&until=1359727199" 


推荐答案

这是因为分页元素是一个命名向量,而不是列表,所以您不能使用 $ 来获取子元素。

It's because the paging element is a named vector, not a list, so you can't use $ to get sub-elements.

以下内容应该起作用:

myposts[[1]]$paging["next"]

这篇关于分析Facebook Json的结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆