parseJson bug

I found a bug in y.parseJson()

Consider this code:

Well, that gives this error:
Exception: Access to Java class "net.sf.json.JSONObject" is prohibited. (<javascript>#30)

I'm getting similarly confusing errors if the json root is an array, rather than an object. This is completely correct, but YQL doesn't seem to like it. It had better swallow it, because there are services out there that work that way. Delicious is one of them.

That shouldn't happen. The JSON is perfectly valid, and this doesn't look like a validation error anyway. Looks like a bug.
Also, I have no control over the json, so it just *has* to be parsed correctly. And it isn't.

Can Yahoo please go ahead and fix it?
Thanks :)

2 Replies
  • Full JSONs that I was trying to parse:

    [{"result": {"kind": "pos#plusones","id": "http://www.google.com/","isSetByViewer": false,"metadata": {"type": "URL","globalCounts": {"count": 131084.0}},"abtk": "AEIZW7RB6LRk5lSx6Jhbtm6Al72seef9qhepo67T0uZWwqwinjinfGR8nciSL4mu+oiZMDGFsnII"},"id": "p"}]

    Valid JSON.

    [{"url": "http://www.google.com/", "total_posts": 21204, "top_tags": {"engine": 1, "web": 1, "search": 1, "google": 1, "reference": 1, "google.com": 1, "bookmarkbar": 1, "searchengine": 1, "searchengines": 1, "tools": 1}, "hash": "ff90821feeb2b02a33a6f9fc8e5f3fcd", "title": "Google"}]

    Valid JSON.
  • Seems there is problem..

    But still you can include parse JSON query to get going https://github.com/douglascrockford/JSON-js/blob/master/json2.js


Recent Posts

in YQL