开发者

RSS to JSON, YQL

开发者 https://www.devze.com 2023-03-19 00:58 出处:网络
I\'m converting RSS to JSON开发者_如何学C 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

I'm converting RSS to JSON开发者_如何学C 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?


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);

0

精彩评论

暂无评论...
验证码 换一张
取 消