Excuse me for this simple problem - but I seem to be missing something obvious. Any pointer would be a big help.
I have JSON like
var whatever = [{ "key1" : { "text" : "text1","group" : "1" }, "key2" : { "text" : "text2","group" : "2" }, "key3" : { "text" : "text3","group" : "3" } }];
I'm trying to add another object (preferably at the beginning), but just couldn't get it to work.
var str = '{"text":"text0","group":"0"}'; var obj = JSON.parse(str); whatever[0].put("key0",obj);
Getting the error below:
Uncaught TypeError: whatever[0].put is not a function
fiddle
source share