PDA

View Full Version : splitting json values



olavevismaya
8 Nov 2010, 3:14 AM
hi....
this is my json format,coming from json file(directly written,not server generated values)
[{
"menubar":[{
"task":"asas",
"reg_no":"123",
"address":"aasdsdf"
},{
"task":"asa",
"reg_no":"1334",
"address":"vv"
}]
},{
"titlebar":[{
"task":"asssss",
"reg_no":"12e",
"address":"dfxdfv"

},{
"task":"asda",
"reg_no":"123q",
"address":"sss"
}]
}]
so now i want split these json values into two arrays.in the front end..I need to split like, menubar items should be in one array and titlebar items should be in another array...how to split....

danguba
8 Nov 2010, 3:40 AM
If U could refactor it to look something like



bars = {
"menubar":[{
"task":"asas",
"reg_no":"123",
"address":"aasdsdf"
},{
"task":"asa",
"reg_no":"1334",
"address":"vv"
}],
"titlebar":[{
"task":"asssss",
"reg_no":"12e",
"address":"dfxdfv"
},{
"task":"asda",
"reg_no":"123q",
"address":"sss"
}]
}Than U would have Ur arrays in bars.menubar and bars.titlebar respectively.

If not U'll need to iterate Ur array