iam able to add more elemnts to the array. check this
JSONArray datarr = new JSONArray();
JSONObject obj1;
JSONObject Array1 = new JSONObject();
try {
for(int i=0;i<4;i++){
obj1 = new JSONObject();
obj1.put("array1val", 5);
obj1.put("array2val", 2);
datarr.put(obj1);
}
Array1.put("Array1", datarr);
Log.v(null, Array1.toString());
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
the out put is
{
"Array1":
[
{
"array1val":5,"array2val":2
},
{
"array1val":5,"array2val":2
},
{
"array1val":5,"array2val":2
},
{
"array1val":5,"array2val":2
}
]
}
is this what your looking for?