Solved

How to use JSONDecoder ?

Posted on 2010-11-10
7
1,547 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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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…
Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

743 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now