title: Parsing Json Object using soap in android
body: <p>I am trying to parse soap response which is json object from service. </p>
  
  <p>Facing below exception. Please help.</p>
  
  <pre><code>soap Service code:
  
  public JSONObject getHotelList(String location){
      JSONObject obj = new JSONObject();
      System.out.println("it is part of webservice and getHotelList");
      con = db.getConnection();
      String hotel = null;
      try{
      Statement st = con.createStatement();
      String sql = "select * from androidtest.hotel_location_list_table where Location=\""+location+"\"";
      ResultSet rs = st.executeQuery(sql);
      while(rs.next()){
          //hotel = rs.getString("HotelName");
          hotellist.add(rs.getString("HotelName"));
      }
      }catch(SQLException e){
          e.printStackTrace();
      }
  
      System.out.println("hotelList--&gt;&gt;"+hotellist);
      obj.put(location, hotellist);
  
      ArrayList&lt;String&gt; out = (ArrayList&lt;String&gt;) obj.get(location);
      System.out.println("out--&gt;&gt;"+out);
  
      return obj;
  }
  
  Client code in android:
  
      protected ArrayList&lt;String&gt; doInBackground(String... arg0) {
      try{
          SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
          SoapObject request = new SoapObject(NAMESPACE, METHOD);
          request.addProperty("location", "Chennai");
          //envelope.bodyOut = request;
          envelope.setOutputSoapObject(request);
             HttpTransportSE transport = new HttpTransportSE(URL);
             try {
                 transport.call(NAMESPACE + SOAP_ACTION_PREFIX + METHOD, envelope);
               } catch (IOException e) {
                 e.printStackTrace();
               } catch (XmlPullParserException e) {
                 e.printStackTrace();
             }
  
             SoapObject resultSOAP= (SoapObject) envelope.getResponse();
             resp=resultSOAP.toString();
               System.out.println("responce from service --&gt;&gt;"+resp);
  
  
               JSONArray jarray = new JSONArray(resultSOAP);
               JSONObject obj = new JSONObject();
               System.out.println("jsonarraylength--&gt;&gt;"+jarray.length());
               for(int i=0;i&lt;jarray.length();i++){
                   obj = jarray.getJSONObject(i);
                   System.out.println(obj.getString("Chennai"));
               }
       }catch(Exception e){
          e.printStackTrace();
      }
  
      return al;
  }
  </code></pre>
  
  <p>Getting below exception..can anyone help</p>
  
  <blockquote>
    <p>org.json.JSONException: Not a primitive array: class
    org.ksoap2.serialization.SoapObject at
    org.json.JSONArray.(JSONArray.java:116) at
    com.example.googleapi.AsyncTaskRunner.doInBackground(AsyncTaskRunner.java:66)
    at
    com.example.googleapi.AsyncTaskRunner.doInBackground(AsyncTaskRunner.java:1)
    at android.os.AsyncTask$2.call(AsyncTask.java:292) at
    java.util.concurrent.FutureTask.run(FutureTask.java:237) at
    android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) at
    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
    at
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
    at java.lang.Thread.run(Thread.java:818)</p>
  </blockquote>
  
  <p>I am in need of sending jsonobject from service and parsing at client side. I am using simple json 1.1.1. jar file for this.</p>