RSS to JSON, YQL
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);
精彩评论