I think that the best way to do It, is using google-gson (A Java library to convert JSON to Java objects and vice-versa)
Download It, add "jar" file to your project
HashMap<String, String> map = new HashMap<String, String>();
map.put("key_1", "Baku");
map.put("key_2", "Azerbaijan");
map.put("key_3", "Ali Mamedov");
Gson gson = new Gson();
System.out.println(gson.toJson(map));
Output:
{"key_3":"Ali Mamedov","key_2":"Azerbaijan","key_1":"Baku"}
You can convert any object (arrays, lists and etc) to JSON. I think, that It is the best analog of PHP's var_dump()