I have an Java Object that I need to POST to a web server. It's a fairly complex object and I was wondering if there was a prebuilt function to do it. The complexity is that I do not want to send JSON but a correctly encoded $_POST:
//THIS IS NOT WHAT I WANT
{
"info": {
"name": "Charlie Chaplin",
"profession": "Actor",
},
"emailAddress": "cc@gmail.com",
}
//THIS IS WHAT I WANT
info[name]=" Charlie Chaplin"&info[profession]="Actor"&emailAddress="cc@gmail.com"
In other words, is there an equivalent to gson.toJson(customer) for URL encoding as opposed to JSON.
A few more detail:
- I am using volley and
getParams() URLEncodeis not what I am looking for. My problem is not special character related.- I know I can write a loop to do it.
0 comments:
Post a Comment