How to convert a json array into a flex 4 array (as3)?
You will need to download the as3corelib library and add it to your Library path
https://github.com/mikechambers/as3corelib
You can then use the JSON decode method which will return an Object.
var object:Object = JSON.decode( jsonString );
but you should be able to coerce your Object into an Array
var array:Array = object as Array;
if for some reason, this doesn't work, you could try
var array:Array = []; for( var prop:String in obj ) array.push( obj[prop] );
i found a way to send json through javascript, el, in a jsf page,first i enconde the the arraylist of objects with the flexjson library in java.
2) the this object i put it in a java bean3) the i call the javascript with the oncomplete event4) like this callapp(#{bean.jsonString})5) this is received in flex with the external interfaceExternalInterface.addCallback
http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7e92.html
6) then something weird occurs, the json string is converted in a array of objects of ACTIONSCRIPTso i just have to loop through the array, and obtain the objects properties and buala …
Here is a simpler way using flex 4.5 internal library (haven't test with flex 4)
import com.adobe.serializers.json.JSONDecoder;var j:JSONDecoder= new JSONDecoder(); var obj:Object= j.decode(json string);myarray= obj as ArrayCollection;