JSONObject jsonObj = new JSONObject();
JSONArray jsonArr = new JSONArray();
JSONObject jsonArrObj = new JSONObject();
try {
int count=1;
while(syncCursor.moveToNext()) {
JSONObject jsonArrObj = new JSONObject();
jsonArrObj.put("arrivalTime",syncCursor.getString(3));
jsonArrObj.put("testCount", count);
count++;
jsonArr.put(jsonArrObj);
Log.d("test",jsonArr.toString());
Log.d("test","====================");
}
jsonObj.put("id", id);
jsonObj.put("data", jsonArr);
Log.d("test",jsonObj.toString());
} catch (JSONException e) {
e.printStackTrace();
}
while 문 안에서 jsonArr을 계속 새로 생성해줘야 할 것 같네요.