{ "Name”: ”ValidateUserName”, “Message”: { ”UserName”: ”p” } }
How could i make these parameters to json format to dynamically pass the parameters to AsyncHTTPClient post method.
Using below method gives a wrong json output
HashMap<String, String> param = new HashMap<String, String>();
JSONObject jsonvalue =new JSONObject();
try {
jsonvalue.put("Name","ValidateUserName");
} catch (JSONException e1) {
e1.printStackTrace();
}
try {
jsonvalue.put("Message",param);
} catch (JSONException e1) {
e1.printStackTrace();
}
Output: { "Name":"ValidateUserName", "Message":" { UserName=amsecmobileuser } " }
Could anyone say why the output is not as expected.......