JSON.decode fails when an object key contains a colon

176 views
Skip to first unread message

Chris Pennello

unread,
Mar 29, 2010, 9:55:07 PM3/29/10
to ActionScript 3 Core Library
The following valid JSON

{"x:": 3}

yields a

SyntaxError: Unexpected token :

when fed to JSON.decode.

Is this a known issue? Is Adobe actively maintaining as3corelib? Or
is it being maintained just by the contributors on the Google code
project site?

Any thoughts or help would be greatly appreciated.

Chris Pennello

unread,
Mar 29, 2010, 11:19:09 PM3/29/10
to ActionScript 3 Core Library
It turns out that the problem isn't with the JSON parser, but instead
with my debugging tools.

I was running the .swf in Chrome and was debugging its behavior by
having Flash use ExternalInterface to call console.log.
Unfortunately, this got poorly translated into the JavaScript
expression

console.log(({x::3}))

which correctly throws an error in the browser.

Debugging in Firefox yielded a much more helpful error message, which
enabled me to figure out what was actually going on.

Reply all
Reply to author
Forward
0 new messages