Send Json Data using Volley from android to server -


i'm trying send array against key server android using volley http client. instead of sending array sends string. here data want send server.

    {"id": "1231241234312", "steps":[{"id":"123","title":"start"}, {} ] } 

steps key contain array on server side, received string.. here android code.

final map<string, string> params = new hashmap<string, string>();                         jsonobject data = new jsonobject();                         try {                             data.put("id", item.getid());                             data.put("status", 3);                             data.put("_action", 1);                         } catch (jsonexception e) {                             e.printstacktrace();                         }                          params.put("id", task.getid());                         params.put("steps", data.tostring()); 

private void makejsonobjreq() {              showprogressdialog();              map<string, string> postparam= new hashmap<string, string>();             postparam.put("key1", "value1");             postparam.put("key2", "value2");       jsonobjectrequest jsonobjreq = new jsonobjectrequest(method.post,             const.url_login, new jsonobject(postparam),             new response.listener<jsonobject>() {                  @override                 public void onresponse(jsonobject response) {                     log.d(tag, response.tostring());                     msgresponse.settext(response.tostring());                     hideprogressdialog();                 }             }, new response.errorlistener() {                  @override                 public void onerrorresponse(volleyerror error) {                     volleylog.d(tag, "error: " + error.getmessage());                     hideprogressdialog();                 }             }) {          /**          * passing request headers          * */         @override         public map<string, string> getheaders() throws authfailureerror {             hashmap<string, string> headers = new hashmap<string, string>();             headers.put("content-type", "application/json; charset=utf-8");             return headers;         }        };      appcontroller.getinstance().addtorequestqueue(jsonobjreq,tag_json_obj);  } 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -