How to convert or cast hashmap to JSON object in Java, and again convert JSON object to JSON string?
If you are using JSR 374: Java API for JSON Processing ( javax json ) This seems to do the trick:
JsonObjectBuilder job = Json.createObjectBuilder((Map) obj); JsonObject jsonObject = job.build();