How to convert json array to flex 4 (as3) array?

Friends ... my json array

{"result":[{"status":0,"statusmsg":"Sorry, that an invalid domain\n","rawout":null,"options":null}]}

how to convert this json array to flex 4 (as3) array?

thanks for the help

+3
source share
3 answers

You need to download the as3corelib library and add it to your library path
https://github.com/mikechambers/as3corelib

Then you can use the JSON decoding method, which will return the object.

    var object:Object = JSON.decode( jsonString );

but you should be able to force your object to an array

    var array:Array = object as Array;

if for some reason this doesn’t work, you can try

    var array:Array = [];
    for( var prop:String in obj )
        array.push( obj[prop] );
+7
source

json javascript, el, jsf, flexjson java.

2) java bean 3) javascript 4), callapp (# {bean.jsonString}) 5) flex ExternalInterface.addCallback

http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7e92.html

6) , json ACTIONSCRIPT buala...

0

Here is a simpler way to use flex 4.5 internal library (don't check 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;
0
source

Source: https://habr.com/ru/post/1776152/


All Articles