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

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -