0

I want to send json object in the http url link as below

http://domainname/xyz?abc=[{"State":"Ap","LastName":"S","FirstName":"James","Email":"adc@gmail.com","Country":"India","City":"Hyd","Barcode":"6598","RecordId":"1234"},{"State":"MP","LastName":"K","FirstName":"Singham","Email":"abc@gmail.com","Country":"India","City":"GN","Barcode":"123","RecordId":"123456","FollowupTypes":"Send Sample;Followup Types"}]

any one help to send a request like this

Thanking you

Chirag
  • 56,621
  • 29
  • 151
  • 198
Dayanand
  • 5
  • 3
  • use [URLEncoding](http://stackoverflow.com/questions/3286067/url-encoding-in-android) for parameter `abc` – sunil Aug 16 '12 at 08:00

1 Answers1

1

I would recommend using Google's gson to encode your object (or array) in json and then add it to the URL :

String url = "http://domainname/xyz?abc=" + URLEncoder.encode(gson.toJson(yourObj), "UTF-8");

You may also use the new Android Json Writer.

Denys Séguret
  • 372,613
  • 87
  • 782
  • 758