I am trying to parse JSON in an Adobe Flex app, using http://www.mikechambers.com/blog/2006/03/28/tutorial-using-json-with-flex-2-and-actionscript-3/'>This Tutorial
Unfortunately, Flex Builder 3 is flagging a "Access of undefined property JSON" error on the line
var arr:Array = (JSON.decode(rawData) as Array);
I don't know what it wants, since I included the import line.
You need to download, install, and reference the utility library that contains the JSON routines. See http://labs.macromedia.com/wiki/index.php/ActionScript_3:resources:apis:libraries#corelib
Did you do that, and include it in your project?
Here is the new location for corelib: https://github.com/mikechambers/as3corelib (as of Feb. 2011 when I'm writing this)
Use the below code
var arr:Array = (com.adobe.serialization.json.JSON.decode(rawData) as Array);
instead of
var arr:Array = (JSON.decode(rawData) as Array);
Dont forget to import below package import com.adobe.serialization.json.JSON;
its working good for me!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With