Posts Tagged ‘REST’

Send JSON objects over Adobe Flex HTTPService call

March 3, 2011 2 comments

It was either incredibly difficult to locate decent references for, or me being incredibly stupid     <– look me indulging in self-degradation and not pompous bragging as often accused by some team members ;-) but I ended up spending all day trying to figure out how to send a JSON object / string over an HTTPService call. It turned out to be quite simple in the end and a thank you goes to and Tomas Mazukna.

Here’s how it is done:

var httpService:HTTPService = new HTTPService();
httpService.contentType = “application/json”;
httpService.resultFormat = HTTPService.RESULT_FORMAT_TEXT

You may end up using AS3Corelib‘s JSONObject to encode your objects as a JSON string:


..and that is all. It is now ready to be consumed by your RESTful service and converted into a plain old object and / or entity depending on what you’re using back there.

PS: Yes, my Flex skills are a bit rusty :-p

Categories: Web Tags: , , ,

Get every new post delivered to your Inbox.

%d bloggers like this: