i have json string which i want to parse in string and add in Array,
also i want to access this value as per field name to display in TextBox.
i have parse the json data in string format but i want to add it in array as per their field name,so that i can access it in textfields.
[{"userid":1,"uname":"andruw","address":"west","city":"london","email" :"andruw@example.com"},
{"userid":2,"uname":"pamela","address":"east","city":"london","email": "pamela@example.com"},
{"userid":3,"uname":"penny","address":"south","city":"paris","email":"penny@example.com"},
{"userid":4,"uname":"jhon","address":"north","city":"zurich","email":"jhon@example.com"}]
Why do you wnat it string in hte first place, now you need to split it to get the info. The honest thing to do is to create a custom class to hold this info and populate the array with objects created from JSON. That way you can easily map data to UI controls.
class Person
{
userId:int;
uname:String;
address:String;
city:String;
email:String;
}
My 2 cents,
C
Hi Claudiu,
I have a json data where the result is two layer down.
If I get the parsed data and want the name I have to write jsonParsed.d.result[0].name, how would i create the class and how will I use the class.
Right now I have:
var jsonParsed:Object = JSON.parse(loader2.data);
Thanks,
Kim
North America
Europe, Middle East and Africa
Asia Pacific