2

I have to pass input parameters to a particular url. I use httpClient to extract the url. I used Live HttpHeaders to see the input parameters and got this below parameters.

{"email":"3rd.ik@gmail.com","password":"etah","meta":{"screen_resolution":{"height":1080,"width":1920}}}

Usually I use List and pass the input parameters like this,

List <NameValuePair> nvps = new ArrayList <NameValuePair>();
nvps.add(new BasicNameValuePair("email", "3rd.ik@gmail.com"));
nvps.add(new BasicNameValuePair("passsword", "etah"));   
nvps.add(new BasicNameValuePair("meta",""));

But not sure how i will pass the height : width as above. ANy inputs much appreciated. Thanks!

Geek
  • 3,187
  • 15
  • 70
  • 115
  • I am not sure but try this `nvps.add(new BasicNameValuePair("meta[screen_resolution][height]","1080"));` – RanRag Feb 15 '12 at 20:57
  • nope it didnt help. Thanks anyways.my repsonse.toString gives me '302 Moved temporarily", but doesnt give me the location. "Location: /" is what i get which means i am missing something. – Geek Feb 15 '12 at 21:04
  • EDIT your question and paste the output of `live http header`. – RanRag Feb 15 '12 at 21:08
  • 2
    Your input parameter is a valid json. So I think you have to create a json object and than send it. Take a look at [link1](http://localtone.blogspot.in/2009/07/post-json-using-android-and-httpclient.html) and [link2](http://stackoverflow.com/questions/3027066/how-to-send-a-json-object-over-request-with-android). – RanRag Feb 15 '12 at 21:12
  • Even JSON would require to add the meta variable. But meta variable has another screen-resolution inside. – Geek Feb 15 '12 at 21:15
  • 1
    See your content `Content-Type: application/json; charset=UTF-8` is json. – RanRag Feb 15 '12 at 21:16
  • Follow the links I mentioned,do some googling. I think you will be able to achieve that. – RanRag Feb 15 '12 at 21:17

0 Answers0