Prabhu M
Prabhu M

Reputation: 3574

Action Script 3.0 : parsing json data

I want to parse the json data shown in this link in AS3 to obtain the "message" field . I am trying with as3corelib.swc with no success. The json data seems to be bit different . Please help me to parse this

I am using the below code

var j:Object = JSON.decode(Json_data);
    var message:String = j["message"];
    trace(message);

Here trace always showing null

Upvotes: 0

Views: 701

Answers (1)

taskinoor
taskinoor

Reputation: 46027

There is no message under root object. Probably you are looking for this:

var j:Object = JSON.decode(str);
var data:Array = j["data"];
for (i = 0; i < data.length; i++) {
    trace(data[i].message);
}

Upvotes: 1

Related Questions