I am using asynchttpclient to do a POST and am constructing a body like this:
{
"params": {
"firstname": "%Paul%"
}
}
The following sometimes produces the right body, sometimes produces an empty body:
String encodedFirstname = "%" + first + "%";
JSONObject paramsVal = new JSONObject();
paramsVal.put("firstname", encodedFirstname);
String[] keys = { "params" };
JSONObject postBody = new JSONObject(paramsVal, keys);
What do I need to correct? Thank you.