RSS 到 JSON、YQL
我正在使用 yql 将 RSS 转换为 JSON,使用 此查询。现在,让我恼火的是我得到了很好的文本响应(请参阅this了解其中的一小部分),但是,当我尝试使用 eval()
(其可信代码)解析它时,它会窒息并显示 Unexpected token ":"
。知道出了什么问题吗?
I'm converting RSS to JSON with yql, with this query. Now, what's irritating me is that I get the text response just fine (see this for a small part of it), but, when I try to parse it with eval()
(its trusted code), it chokes and says Unexpected token ":"
. Any idea what's going wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不需要使用 eval 解析 JSON - 有关详细信息,请参阅本文
您可以解析 JSON使用 Douglas Crockford 的 JSON 函数,可以从 github 下载。这应该可以解决任何令人头疼的评估问题。
因此,从上面的 github 页面下载 json2.js。将其包含在您的页面中,如下所示:
,然后使用以下方法解析您的 JSON 字符串:
var myJsonObject = JSON.parse( myJsonString);
You don't need to parse JSON with eval - see this article for more information
You can parse JSON using Douglas Crockford's JSON functions which can be downloaded from github here. This should solve any eval headaches.
So, download json2.js from the above github page. Include it in your page like this:
<script src="json2.js"></script>
and then parse your JSON string using:
var myJsonObject = JSON.parse(myJsonString);