<p>I have a script that retrieves objects from a remote server through an Ajax call. The server returns objects in JSON notation.­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­</p>

<p>However, in Adobe AIR, there is a restriction on using <a href="http://labs.adobe.com/wiki/index.php/AIR:HTML_Security_FAQ#Why_restrict_eval.28.29_for_all_Application_content_if_there_are_legitimate_use_cases_for_using_it.3F" rel="nofollow noreferrer">eval()</a> for security reasons. So I'm able to get replies from the remote server, but can't turn them back into JavaScript objects. Is there any workaround for this issue? I would like to use JSON for my JavaScript objects, since it can be used almost immediately.</p>

<p>Side-note : I do understand the security implications for forcing the issue, but I will be doing some rapid application development for a competition, so the program would only be a quick prototype, and not used for production purposes. Nevertheless, it would be great if there's a better alternative to what I'm trying to do now</p>

<hr>

<p><strong>Update:</strong></p>

<p>Thanks to <a href="https://stackoverflow.com/a/24919/7750640">Theo</a> and <a href="https://stackoverflow.com/a/21716/7750640">jsight</a> for their answers; </p>

<p>One important thing I learnt today is that I can actually make use of ActionScript libraries by using the <pre>&lt;script src="lib/myClasses.swf" type="application/x-shockwave-flash"&gt;&lt;/script&gt;</pre> tag extended by Adobe AIR. Check out <a href="https://stackoverflow.com/a/24919/7750640">Theo's</a> link for more details!</p>

[{'answer_id': 21716, 'author': 'jsight', 'author_id': 1432, 'author_profile': 'https://Stackoverflow.com/users/1432', 'pm_score': 2, 'selected': False, 'text': '<p>Have you looked at <a href="http://code.google.com/p/as3corelib/" rel="nofollow noreferrer">as3corelib</a>?  It appears to provide an AS3 parser for JSON data, and my hope would be that it doesn\'t rely upon eval (eval tends to be bad for security as you noted).  There are similar libs for Javascript as well, and they tend to be the preferred way to parse json due to the security implications of calling eval on (potentially) evil data.</p>\n'}, {'answer_id': 22099, 'author': 'Mark Ingram', 'author_id': 986, 'author_profile': 'https://Stackoverflow.com/users/986', 'pm_score': 0, 'selected': False, 'text': '<p>JSON is Javascript Object Notation, so if you are using Javascript you are already there!\nHave a look at these links, they give examples of how to create Javascript objects from JSON:</p>\n\n<p><a href="http://www.hunlock.com/blogs/Mastering_JSON_(_JavaScript_Object_Notation_)" rel="nofollow noreferrer">http://www.hunlock.com/blogs/Mastering_JSON_(_JavaScript_Object_Notation_)</a></p>\n\n<p><a href="http://betterexplained.com/articles/using-json-to-exchange-data/" rel="nofollow noreferrer">http://betterexplained.com/articles/using-json-to-exchange-data/</a></p>\n\n<p>If you decide to go the Flex / AS3 route, then as the jsight said, as3corelib is a good place to start.</p>\n'}, {'answer_id': 24919, 'author': 'Theo', 'author_id': 1109, 'author_profile': 'https://Stackoverflow.com/users/1109', 'pm_score': 4, 'selected': True, 'text': '<p>You can find a <a href="http://www.JSON.org/js.html" rel="noreferrer">JSON parser written in JavaScript here</a> (<a href="https://github.com/douglascrockford/JSON-js/blob/master/json2.js" rel="noreferrer">source code here</a>). You can also use the as3corelib JSON parser from JavaScript, there\'s <a href="http://help.adobe.com/en_US/AIR/1.1/devappshtml/WS5b3ccc516d4fbf351e63e3d118666ade46-7ed9.html" rel="noreferrer">a description of how to access ActionScript libraries from JavaScript here</a>.</p>\n'}, {'answer_id': 26614, 'author': 'John Lemberger', 'author_id': 2882, 'author_profile': 'https://Stackoverflow.com/users/2882', 'pm_score': 0, 'selected': False, 'text': '<p>I think this is possible if you use an iframe and sandbox bridge.  You should be able to run eval() on downloaded code in the sandboxed iframe,</p>\n\n<p>Excerpt from <a href="http://help.adobe.com/en_US/AIR/1.1/devappshtml/WS5b3ccc516d4fbf351e63e3d118666ade46-7f11.html#WS5b3ccc516d4fbf351e63e3d118666ade46-7e40" rel="nofollow noreferrer">Adobe AIR 1.1 Doc\'s</a>\n"...it may be more convenient to run content in a sandboxed child frame so that the content can be run with no restrictions on eval()..."</p>\n\n<p>Another related article:  <a href="http://www.sitepen.com/blog/2008/08/21/building-on-air-working-with-the-sandbox-bridges/" rel="nofollow noreferrer">Building on AIR: Working with the Sandbox Bridges</a></p>\n'}, {'answer_id': 4524589, 'author': 'Chris Dolan', 'author_id': 14783, 'author_profile': 'https://Stackoverflow.com/users/14783', 'pm_score': 2, 'selected': False, 'text': '<p>The current AIR release (v2.5) bundles a newer WebKit that has native JSON support, via JSON.stringify() and JSON.parse().</p>\n'}]
['https://Stackoverflow.com/questions/21651', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2504504/']