How to convert or cast hashmap to JSON object in Java, and again convert JSON object to JSON string?
You can use:
new JSONObject(map);
Caution: This will only work for a Map!
Map!
Other functions you can get from its documentation http://stleary.github.io/JSON-java/index.html