last day (14 days later) » 

12:34 PM
0
A: how to push json data into array with 2 level or n level

Harutyun AbgaryanFIRST CHANGE YOU ARRAY NAME try this var m = {}; m.name=[]; m.name.push({ name: "Gareth" }); m.name.push({ name: "john" }); // This statement doesn't work as name[0]!=[] I guess. m.name.push({name:"dolly"}); out put

 
How would it work? will you explain me?
 
You in array set object and in object not [0] item
 
Have you checked an out put of it? it doesn't give me an output that i'm lookin' for... It works but not the way i want. If you could help me more.
Output should be: +name=> expand it. it gives you +[0]=> expand it it gives you name : "gareth" +0, +1.... I hope you understand it. it belongs to .net framework output which could be seen through output intellisense....
 
Sorry i updated code try this
 
Oh no... Should not be like this...It should be lik Oth index must contain {name:gareth, oth obj,1st obj}...
I have mentioned which kinda output i want to have.
 
12:34 PM
then try this i uupdated code see output image
hi
worked code?
 
Nope
It doesn't
 
Please send me output example
 
Are you getting what i want to get? Later i want to use ng-repeat so I want an output in that format only. I want to show Menu and submenu later.
In your output if you expand Oth index it gets you "Gareth" which is correct.
but other two object are not bound to Oth index.
inject both objects to Oth index as well....
 
for example object must be this object {name:{name:"Greath"}} ??
 
+name <--- expandable

+0 <--- expandable

name : "gareth"

+0 <--- expandable
name: "john"

+1 <--- expandable
name: "dolly"
is it what your not getting?
name:
 
12:44 PM
my object getting this
 
name:
[0]
name:Gareth
[0]
[1]
Nope it doesn't
Check that out.
If you expand Oth index it gets you Gareth name only.
What about two below objects.
I want to get those two below objects into Oth index.
I hope I'm clear now.
 
{name:[0].name='ssss'}
this
 
Why are you not getting. Let me know if it is possible or not.
Here you have expanded Oth index. So you are getting Gareth now. Right?
object 1 and object 2 are siblings of Oth index.
Make them child of Oth index.
That is what i want.
oK Thanks for the help
 

last day (14 days later) »