Pages

Thursday, April 12, 2018

Convert a Hashmap to JSON String in Java

Convert a Hashmap to JSON Object in Java

I was working in a Java Code and I wanted to see the contents of a hashmap as JSON String .
I liked the Google API that converts a Hashmap to JSON String

Gson gson = new Gson(); 
String json = gson.toJson(myObject); 
 
Reference:
https://stackoverflow.com/questions/12155800/how-to-convert-hashmap-to-json-object-in-java 

No comments:

Post a Comment