Create Json Array in Javascript Dynamically
This is an example to create Json Array in Javascript dynamically using new Array(), new Object() and .push(). < script > var obj = new Array ( ) ; for ( i = 1 ; i <= 5 ; i ++ ) { var jsonData = new Object ( ) ; jsonData . key = "ID" ; jsonData . value = i ; obj . push ( jsonData ) ; } console . log ( obj ) ; < / script >