.push
does not require you delcare it as an array ( like you tried obj.push([{
- unless of course you are pushing an array into an array
Just simply ...
obj.push({"name" : maintasks_val.task_name, ..
adds a new single item intto the array
Update as comment , yes, declare obj
as a typeof
array first
var obj=[];
This is now the same as the data
array you have shown in your docs example - and we can now .push()
into it.