0

我想在 http url 链接中发送 json 对象,如下所示

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"}]

任何人都可以帮助发送这样的请求

感谢您

4

1 回答 1

1

我建议使用Google 的 gson将您的对象(或数组)编码为 json,然后将其添加到 URL 中:

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

您也可以使用新的Android Json Writer

于 2012-08-16T08:01:10.357 回答