Solved

How to use JSONDecoder ?

Posted on 2010-11-10
7
1,559 Views
Last Modified: 2012-05-10
Hi,

I like to decode a JSON string with Flash Builder 4.
So I include com.adobe.serializers.json but can't find any methode there for.

Can somebody show me how to use JSONDecoder please?

Thanks

Andre
0
Comment
Question by:andre72
  • 4
  • 3
7 Comments
 
LVL 17

Expert Comment

by:deepanjandas
ID: 34102199
//sample json data passed - [ {"name":"Jaylo", "number":"3243251"}, {"name":"Jenny", "phone":"8675309"}])

var jsonData:String = "[ {"name":"Jaylo", "number":"3243251"}, {"name":"Jenny", "phone":"8675309"}])";

var data:Array= JSON.decode(loader.data) ;
trace(People[0].name) ; //Jaylo
trace(People[0].number) ; //3243251
trace(People[1].name) ; //Jenny
trace(People[1].number) ; //8675309

Here the object returned is an Array; it can also be object.

Warm Regards
Deepanjan Das
http://deepanjandas.wordpress.com
0
 
LVL 17

Expert Comment

by:deepanjandas
ID: 34102244
Sorry dude, I copied it wrong above.
//sample json data passed - [ {"name":"Jaylo", "number":"3243251"}, {"name":"Jenny", "phone":"8675309"}])

var jsonData:String = "[ {"name":"Jaylo", "number":"3243251"}, {"name":"Jenny", "phone":"8675309"}])";

var data:Array= JSON.decode(jsonData) ;

Also try using ObjectUtils.toString(data);
trace(data[0].name) ; //Jaylo
trace(data[0].number) ; //3243251
trace(data[1].name) ; //Jenny
trace(data[1].number) ; //8675309

Here the object returned is an Array; it can also be object.

Warm Regards
Deepanjan Das
http://deepanjandas.wordpress.com
0
 

Author Comment

by:andre72
ID: 34102307
Yes I read some threads like this but I've no JSON.decode()

I thinks you use the workspace com.adobe.serialization but this one I've not available.
The one I found is called com.adobe.serializers and it doesn't contain decode() ...
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 17

Accepted Solution

by:
deepanjandas earned 500 total points
ID: 34102335
Hi,
Kindly find the adobe package for JSON.

Warm Regards
Deepanjan Das
http://deepanjandas.wordpress.com
com.zip
0
 

Author Comment

by:andre72
ID: 34102716
deepanjandas thank you very much.
Maybe you can also tell a novice in which directory to place it best and how to referer it than to my project - or will Flex recognize it by itself than?
0
 
LVL 17

Expert Comment

by:deepanjandas
ID: 34102732
Do you have a src folder, so just paste the com folder under src and you should be done.


Warm Regards
Deepanjan Das
http://deepanjandas.wordpress.com
0
 

Author Closing Comment

by:andre72
ID: 34110317
Thanks for your support
0

Featured Post

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Adobe Air with Flex on ios 2 1,119
Clickable link on fields from mysql 7 339
Flex (as3) add parameters to addEventListener 2 756
Adobe URL is default to local hosts in my Mac Air 13 539
First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question