Instantly share code, notes, and snippets.

Embed
What would you like to do?
Serialize map to POST data in Java
StringBuffer paramStr = new StringBuffer();
for(String key : params.keySet()) {
paramStr.append(URLEncoder.encode(key));
paramStr.append("=");
paramStr.append(URLEncoder.encode(params.get(key)));
paramStr.append("&");
}
String postData = paramStr.toString();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment