Click here to Skip to main content
15,885,141 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear all,

I am newbie to flex, what I want to realize is the communication between flex and JSON.

In my flex actionscript, I will:

(1) POST a url to JSON
(2) get all contents of the url.

I have searched the related topic for quite a while, but I almost confuse myself.
- what should I use for the HTTPService, GET or POST?

- what should I define for the Serializable class of the structure as in the url? I have tried a few but both have errors.

- Is there similar reference for it?

The following is what I see from the url:

[
-{
"item_no": "7415926",
"item_seg_id": "7415926-1",
"type": "PROJECT",
},
-{
"item_no": "7415924",
"item_seg_id": "7415924-3",
"type": "TRIAL",
}
]

Can anybody give me some instruction, thanks a lot!
Posted

1 solution

Hi,
I have share the sameple
HTML
var urlLoader:URLLoader = new URLLoader();
urlLoader.dataFormat = URLLoaderDataFormat.TEXT; 
urlLoader.addEventListener(Event.COMPLETE, urlLoader_complete);
urlLoader.load(new URLRequest("Enter Your Josn path"));

protected function urlLoader_complete(event:Event):void 
{
   var resultData:Object = JSON.parse(event.target.data);
}

Now the JSON data is in resultData variable...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900