How can I create this JSON using ArrayList for posting json in Android
{
"user" :
{
"nickname" : "nickname6",
"password" : "1234",
}
}
I get only to a flat JSON
ArrayList<BasicNameValuePair> nameValuePairs = new ArrayList<BasicNameValuePair>();
nameValuePairs.add(new BasicNameValuePair("nickname","nickname6"));
nameValuePairs.add(new BasicNameValuePair("password", "1234"));
You need to create a JSON, and for that you have to add that JSON as a parameter in your POST method. To do that you can try this :