javascript - Pushing data into an array in a Json object -


i need push an object array in in json file. make simple lets json looks this:

var jsonobj = { "elements" : [] } 

i tried push() method didnt work. tried assign jsonobj.elements[0]= ... fails. how can make work?

try way, has work:

jsonobj.elements.push(1); 

fiddle: https://jsfiddle.net/29qa4bfw/1/


Comments

Popular posts from this blog

How to run C# code using mono without Xamarin in Android? -

c# - SharpSsh Command Execution -

python - Specify path of savefig with pylab or matplotlib -