title: JSONexception while fetching JSONArray JSONObject
body: <p>Getting JSON Exception while fetching json response from server.I have tried many solutions given on stackoverflow but thats not working.Below is my code for sending parameters to the sever and fetching json.Please help me guys.Any help will be appreciated.
  Thanks</p>
  
  <p>JSON Response from server:</p>
  
  <p>Note:"upload" is an JSONarray .</p>
  
  <pre><code>  {
          "code": 200,
          "upload": {
          "Booking": {
          "id": "17",
          "contributor_id": "16",
          "table_of_content_id": "1",
          "composition_id": "12",
          "completion": "2017-05-20",
          "approved": null,
          "cdn_id": null,
          "secret_token": null,
          "uploaded_on": null,
          "created": "2017-05-09 14:41:49",
          "modified": "2017-05-09 14:41:49"
          },
          "TableOfContent": {
          "id": "1",
          "name": "গোরা",
          "category_id": "1",
          "language_id": "1",
          "created": "2016-03-09 03:39:01",
          "modified": "2016-03-09 14:39:01"
          }
          }
          }
  </code></pre>
  
  <p>This is how i am trying to do it.</p>
  
  <pre><code>public void forwardtoOurServer() {
          JSONObject jsonObject=null;
          String tag_string_req = "req_login";
          StringRequest postStringRequest = new StringRequest(Request.Method.POST, RECORD_COMPOSITION_API,
                  new Response.Listener&lt;String&gt;() {
  
                      @Override
                      public void onResponse(String response) {
                          Log.d(TAG, "Audio Upload Response Check :" + response);
  
  
                          try {
                              JSONObject json = new JSONObject(response);
                              String code = json.getString("code");
                              JSONArray obj = json.getJSONArray("upload");
                              Log.d(TAG, "obj Response Check :" + obj);
                              for (int i = 0; i &lt; obj.length(); i++) {
  
                                  JSONObject jsonObject = obj.getJSONObject(i);
                                  Log.d(TAG, "jsonObject Response Check :" + jsonObject);
                                  JSONObject bookings = obj.getJSONObject(Integer.parseInt("Booking"));
  
  //                                int id = jsonObject.getInt("id");
  //
  //                                String type = jsonObject.getString("type");
  
                                  // retrieve the values like this so on..
  
                              }
  
                          } catch (JSONException e) {
                              e.printStackTrace();
                          }
  
  
                      }
                  },
                  new Response.ErrorListener() {
                      @Override
                      public void onErrorResponse(VolleyError error) {
                          Log.e(TAG, "Error Response Check :" + error);
  
                      }
                  }) {
  
              @RequiresApi(api = Build.VERSION_CODES.N)
              @Override
              protected Map&lt;String, String&gt; getParams() {
                  Map&lt;String, String&gt; params = new HashMap&lt;String, String&gt;();
                  params.put("data[Booking][id]",bookingId);
                  params.put("data[Booking][contributor_id]",contributor_id);
                  params.put("data[Booking][table_of_content_id]",tocId);
                  params.put("data[Booking][cdn_id]",vs_cdn_id);
                  params.put("data[Booking][secret_token]",secret_token);
                  SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
                  sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
                  Date now = new Date();
                  String strDate = sdf.format(now);
                  params.put("data[Booking][uploaded_on]",strDate);
                  Log.d(TAG, "Params :" + params);
                  return params;
  
              }
  
              @Override
              public Map&lt;String, String&gt; getHeaders() throws AuthFailureError {
                  Map&lt;String, String&gt; headers = new HashMap&lt;String, String&gt;();
                  headers.put("Content-Type", "application/x-www-form-urlencoded");
                  headers.put("UUID", device_uuid);
                  headers.put("APPID", "2A192A0C22");
                  headers.put("USERID", "1");
                  headers.put("PLATFORM", "Andriod");
                  headers.put("APP_REQUEST", "1");
                  headers.put("PLATFORMVERSION",androidOS);
                  return headers;
              }
  
          };
  
  
          AppController.getInstance().addToRequestQueue(postStringRequest, tag_string_req);
  
      }
  </code></pre>
  
  <p>Log:</p>
  
  <pre><code>06-07 12:44:18.865 13701-13903/com.showhow2.www.thetagoreproject D/Null: Params :{data[Booking][cdn_id]=326929293, data[Booking][table_of_content_id]=1, data[Booking][id]=16, data[Booking][secret_token]=s-0DT7x, data[Booking][contributor_id]=16, data[Booking][uploaded_on]=2017-06-07T07:14:18Z}
  06-07 12:44:20.629 13701-13701/com.showhow2.www.thetagoreproject D/Null: Audio Upload Response Check :{"code":200,"upload":{"Booking":{"id":"17","contributor_id":"16","table_of_content_id":"1","composition_id":"12","completion":"2017-05-20","approved":null,"cdn_id":null,"secret_token":null,"uploaded_on":null,"created":"2017-05-09 14:41:49","modified":"2017-05-09 14:41:49"},"TableOfContent":{"id":"1","name":"\u0997\u09cb\u09b0\u09be","category_id":"1","language_id":"1","created":"2016-03-09 03:39:01","modified":"2016-03-09 14:39:01"},"Composition":{"id":"12","content":"\u09ac\u09bf\u09a8\u09df \u0993 \u0997\u09cb\u09b0\u09be \u09aa\u09b0\u09c7\u09b6\u09c7\u09b0 \u09ac\u09be\u09dc\u09bf \u09b9\u0987\u09a4\u09c7 \u09b0\u09be\u09b8\u09cd\u09a4\u09be\u09df \u09ac\u09be\u09b9\u09bf\u09b0 \u09b9\u0987\u09b2\u09c7 \u09ac\u09bf\u09a8\u09df \u0995\u09b9\u09bf\u09b2, &amp;quot;\u0997\u09cb\u09b0\u09be, \u098f\u0995\u099f\u09c1 \u0986\u09b8\u09cd\u09a4\u09c7 \u0986\u09b8\u09cd\u09a4\u09c7 \u099a\u09b2\u09cb \u09ad\u09be\u0987-- \u09a4\u09cb\u09ae\u09be\u09b0 \u09aa\u09be \u09a6\u09c1\u099f\u09cb \u0986\u09ae\u09be\u09a6\u09c7\u09b0 \u099a\u09c7\u09df\u09c7 \u0985\u09a8\u09c7\u0995 \u09ac\u09dc\u09cb-- \u0993\u09b0 \u099a\u09be\u09b2\u099f\u09be \u098f\u0995\u099f\u09c1 \u0996\u09be\u099f\u09cb \u09a8\u09be \u0995\u09b0\u09b2\u09c7 \u09a4\u09cb\u09ae\u09be\u09b0 \u09b8\u0999\u09cd\u0997\u09c7 \u09af\u09c7\u09a4\u09c7 \u0986\u09ae\u09b0\u09be \u09b9\u09be\u0981\u09aa\u09bf\u09df\u09c7 \u09aa\u09dc\u09bf\u0964&amp;quot;\n \u0997\u09cb\u09b0\u09be \u0995\u09b9\u09bf\u09b2, &amp;quot;\u0986\u09ae\u09bf \u098f\u0995\u09b2\u09be\u0987 \u09af\u09c7\u09a4\u09c7 \u099a\u09be\u0987, \u0986\u09ae\u09be\u09b0 \u0986\u099c \u0985\u09a8\u09c7\u0995 \u0995\u09a5\u09be \u09ad\u09be\u09ac\u09ac\u09be\u09b0 \u0986\u099b\u09c7\u0964&amp;quot;\n \u09ac\u09b2\u09bf\u09df\u09be \u09a4\u09be\u09b9\u09be\u09b0 \u09b8\u09cd\u09ac\u09be\u09ad\u09be\u09ac\u09bf\u0995 \u09a6\u09cd\u09b0\u09c1\u09a4\u0997\u09a4\u09bf\u09a4\u09c7 \u09b8\u09c7 \u09ac\u09c7\u0997\u09c7 \u099a\u09b2\u09bf\u09df\u09be \u0997\u09c7\u09b2\u0964\n \u09ac\u09bf\u09a8\u09df\u09c7\u09b0 \u09ae\u09a8\u09c7 \u0986\u0998\u09be\u09a4 \u09b2\u09be\u0997\u09bf\u09b2\u0964 \u09b8\u09c7 \u0986\u099c \u0997\u09cb\u09b0\u09be\u09b0 \u09ac\u09bf\u09b0\u09c1\u09a6\u09cd\u09a7\u09c7 \u09ac\u09bf\u09a6\u09cd\u09b0\u09cb\u09b9 \u0995\u09b0\u09bf\u09df\u09be \u09a4\u09be\u09b9\u09be\u09b0 \u09a8\u09bf\u09df\u09ae \u09ad\u0999\u09cd\u0997 \u0995\u09b0\u09bf\u09df\u09be\u099b\u09c7\u0964 \u09b8\u09c7 \u09b8\u09ae\u09cd\u09ac\u09a8\u09cd\u09a7\u09c7 \u0997\u09cb\u09b0\u09be\u09b0 \u0995\u09be\u099b\u09c7 \u09a4\u09bf\u09b0\u09b8\u09cd\u0995\u09be\u09b0 \u09ad\u09cb\u0997 \u0995\u09b0\u09bf\u09b2\u09c7 \u09b8\u09c7 \u0996\u09c1\u09b6\u09bf \u09b9\u0987\u09a4\u0964 \u098f\u0995\u099f\u09be \u099d\u09dc \u09b9\u0987\u09df\u09be \u0997\u09c7\u09b2\u09c7\u0987 \u09a4\u09be\u09b9\u09be\u09a6\u09c7\u09b0 \u099a\u09bf\u09b0\u09a6\u09bf\u09a8\u09c7\u09b0 \u09ac\u09a8\u09cd\u09a7\u09c1\u09a4\u09cd\u09ac\u09c7\u09b0 \u0986\u0995\u09be\u09b6 \u09b9\u0987\u09a4\u09c7 \u0997\u09c1\u09ae\u099f \u0995\u09be\u099f\u09bf\u09df\u09be \u09af\u09be\u0987\u09a4 \u098f\u09ac\u0982 \u09b8\u09c7 \u09b9\u09be\u0981\u09aa \u099b\u09be\u09dc\u09bf\u09df\u09be \u09ac\u09be\u0981\u099a\u09bf\u09a4\u0964\n \u09a4\u09be\u09b9\u09be \u099b\u09be\u09dc\u09be \u0986\u09b0-\u098f\u0995\u099f\u09be \u0995\u09a5\u09be \u09a4\u09be\u09b9\u09be\u0995\u09c7 \u09aa\u09c0\u09dc\u09be \u09a6\u09bf\u09a4\u09c7\u099b\u09bf\u09b2\u0964 \u0986\u099c \u09b9\u09a0\u09be\u09ce \u0997\u09cb\u09b0\u09be \u09aa\u09b0\u09c7\u09b6\u09c7\u09b0 \u09ac\u09be\u09dc\u09bf\u09a4\u09c7 \u09aa\u09cd\u09b0\u09a5\u09ae \u0986\u09b8\u09bf\u09df\u09be\u0987 \u09ac\u09bf\u09a8\u09df\u0995\u09c7 \u09b8\u09c7\u0996\u09be\u09a8\u09c7 \u09ac\u09a8\u09cd\u09a7\u09c1\u09ad\u09be\u09ac\u09c7 \u09ac\u09b8\u09bf\u09df\u09be \u09a5\u09be\u0995\u09bf\u09a4\u09c7 \u09a6\u09c7\u0996\u09bf\u09df\u09be \u09a8\u09bf\u09b6\u09cd\u099a\u09df\u0987 \u09ae\u09a8\u09c7 \u0995\u09b0\u09bf\u09df\u09be\u099b\u09c7 \u09ac\u09bf\u09a8\u09df \u098f \u09ac\u09be\u
  06-07 12:44:20.663 13701-13701/com.showhow2.www.thetagoreproject W/System.err: org.json.JSONException: Value {"Booking":{"id":"17","contributor_id":"16","table_of_content_id":"1","composition_id":"12","completion":"2017-05-20","approved":null,"cdn_id":null,"secret_token":null,"uploaded_on":null,"created":"2017-05-09 14:41:49","modified":"2017-05-09 14:41:49"},"TableOfContent":{"id":"1","name":"গোরা","category_id":"1","language_id":"1","created":"2016-03-09 03:39:01","modified":"2016-03-09 14:39:01"},"Composition":{"id":"12","content":"বিনয় ও গোরা পরেশের বাড়ি হইতে রাস্তায় বাহির হইলে বিনয় কহিল, &amp;quot;গোরা, একটু আস্তে আস্তে চলো ভাই-- তোমার পা দুটো আমাদের চেয়ে অনেক বড়ো-- ওর চালটা একটু খাটো না করলে তোমার সঙ্গে যেতে আমরা হাঁপিয়ে পড়ি।&amp;quot;\n গোরা কহিল, &amp;quot;আমি একলাই যেতে চাই, আমার আজ অনেক কথা ভাববার আছে।&amp;quot;\n বলিয়া তাহার স্বাভাবিক দ্রুতগতিতে সে বেগে চলিয়া গেল।\n বিনয়ের মনে আঘাত লাগিল। সে আজ গোরার বিরুদ্ধে বিদ্রোহ করিয়া তাহার নিয়ম ভঙ্গ করিয়াছে। সে সম্বন্ধে গোরার কাছে তিরস্কার ভোগ করিলে সে খুশি হইত। একটা ঝড় হইয়া গেলেই তাহাদের চিরদিনের বন্ধুত্বের আকাশ হইতে গুমট কাটিয়া যাইত এবং সে হাঁপ ছাড়িয়া বাঁচিত।\n তাহা ছাড়া আর-একটা কথা তাহাকে পীড়া দিতেছিল। আজ হঠাৎ গোরা পরেশের বাড়িতে প্রথম আসিয়াই বিনয়কে সেখানে বন্ধুভাবে বসিয়া থাকিতে দেখিয়া নিশ্চয়ই মনে করিয়াছে বিনয় এ বাড়িতে সর্বদাই যাতায়াত করে। অবশ্য, যাতায়াত করিলে যে কোনো অপরাধ আছে তাহা নয়; গোরা যাহাই বলুক পরেশবাবুর সুশিক্ষিত পরিবারের সঙ্গে অন্তরঙ্গভাবে পরিচিত হইবার সুযোগ পাওয়া বিনয় একটা বিশেষ লাভ বলিয়া গণ্য করিতেছে; ইঁহাদের সঙ্গে মেশামেশি করাতে গোরা যদি কোনো দোষ দেখে তবে সেটা তাহার নিতান্ত গোঁড়ামি; কিন্তু পূর্বের কথাবার্তায় গোরা নাকি জানিয়াছে যে বিনয় পরেশবাবুর বাড়িতে যাওয়া-আসা করে না, আজ সহসা তাহার মনে হইতে পারে যে সে কথাটা সত্য নয়। বিশেষত বরদাসুন্দরী তাহাকে বিশেষ করিয়া ঘরে ডাকিয়া লইয়া গেলেন, সেখানে তাঁহার মেয়েদের সঙ্গে তাহার আলাপ হইতে লাগিল-- গোরার তীক্ষ্ণ লক্ষ হইতে ইহা এড়াইয়া যায় নাই। মেয়েদের সঙ্গে এইরূপ মেলামেশায় ও বরদাসুন্দরীর আত্মীয়তায় মনে মনে বিনয় ভার�
  06-07 12:44:20.663 13701-13701/com.showhow2.www.thetagoreproject W/System.err:     at org.json.JSON.typeMismatch(JSON.java:100)
  06-07 12:44:20.663 13701-13701/com.showhow2.www.thetagoreproject W/System.err:     at org.json.JSONObject.getJSONArray(JSONObject.java:588)
  06-07 12:44:20.663 13701-13701/com.showhow2.www.thetagoreproject W/System.err:     at com.showhow2.www.thetagoreproject.RecordComposition$16.onResponse(RecordComposition.java:704)
  06-07 12:44:20.663 13701-13701/com.showhow2.www.thetagoreproject W/System.err:     at com.showhow2.www.thetagoreproject.RecordComposition$16.onResponse(RecordComposition.java:694)
  06-07 12:44:20.663 13701-13701/com.showhow2.www.thetagoreproject W/System.err:     at com.android.volley.toolbox.StringRequest.deliverResponse(StringRequest.java:60)
  06-07 12:44:20.663 13701-13701/com.showhow2.www.thetagoreproject W/System.err:     at com.android.volley.toolbox.StringRequest.deliverResponse(StringRequest.java:30)
  06-07 12:44:20.663 13701-13701/com.showhow2.www.thetagoreproject W/System.err:     at com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(ExecutorDelivery.java:99)
  06-07 12:44:20.663 13701-13701/com.showhow2.www.thetagoreproject W/System.err:     at android.os.Handler.handleCallback(Handler.java:739)
  06-07 12:44:20.663 13701-13701/com.showhow2.www.thetagoreproject W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:95)
  06-07 12:44:20.663 13701-13701/com.showhow2.www.thetagoreproject W/System.err:     at android.os.Looper.loop(Looper.java:148)
  06-07 12:44:20.663 13701-13701/com.showhow2.www.thetagoreproject W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:5417)
  06-07 12:44:20.663 13701-13701/com.showhow2.www.thetagoreproject W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
  06-07 12:44:20.664 13701-13701/com.showhow2.www.thetagoreproject W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
  06-07 12:44:20.664 13701-13701/com.showhow2.www.thetagoreproject W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
  </code></pre>