title: create json data in android for call logs
body: <p>I want to create a json format  for my call logs details like the below and send it to the server in android  :</p>
  
  <p>{"Calllogs":{</p>
  
  <p>"logdata":[</p>
  
  <p>{
  "id":"9791",
  "number":"+919122185954",
  "duration":"0",
  "types":"3",
  "date":"1425887846182",
  "name":"ww"}
  ,
  {</p>
  
  <p>"id":"9790",
  "number":"+91712222777",
  "duration":"32",
  "types":"1",
  "date":"1425880324221",
  "name":"Dpika"}
  :
  :
  :
  :</p>
  
  <p>]}}</p>
  
  <p>but when i use the below code to fetch all the call logs details in json format and send it to the server , i am getting a very unusual error like when i send 30 contacts it is working fine but when i fetch more than that i am getting an error ????  </p>
  
  <p>CODE:  </p>
  
  <pre><code>public void GetCallLogs()
    {
          JSONObject main= new JSONObject();
          JSONObject calllogs = new JSONObject();
          JSONArray logs = new JSONArray();
        Cursor cur = getContentResolver().query(Uri.parse("content://call_log/calls"),null, null, null, "_ID DESC");
  
          cur.moveToFirst();
  
          int nameColumn = cur.getColumnIndex(CallLog.Calls.CACHED_NAME);
          int numberColumn = cur.getColumnIndex(CallLog.Calls.NUMBER);
          int dateColumn = cur.getColumnIndex(CallLog.Calls.DATE);
          int duretion = cur.getColumnIndex(CallLog.Calls.DURATION);
          int type = cur.getColumnIndex(CallLog.Calls.TYPE);
          int id = cur.getColumnIndex(CallLog.Calls._ID);
  
          int i=0;
  
          JSONObject studenti = new JSONObject();
          while (!cur.isAfterLast() &amp;&amp; i &lt; 50) {
  
              String name = cur.getString(nameColumn);
              String number = cur.getString(numberColumn);
              String date = cur.getString(dateColumn);
              String duration = cur.getString(duretion);
              String types = cur.getString(type);
              String ids = cur.getString(id);
  
  
  
              try {
                  studenti.put("id", ids);
                  studenti.put("name",name);
                  studenti.put("date", date);
                  studenti.put("duration", duration);
                  studenti.put("types", types);
                  studenti.put("number", number);
  
                  Log.d("HERE IN FETCHCALL", "name"+name);
  
  
              } catch (JSONException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
  
  
  
  
              logs.put(studenti);
  
  
              studenti = new JSONObject();
  
  
  
              cur.moveToNext();
          i++;
          }
  
          try {
              calllogs.put("logdata", logs);
          } catch (JSONException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
  
  
        try {
          main.put("Calllogs", calllogs);
      } catch (JSONException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
  
  
    }
  </code></pre>