Converting Java object to JSON (GSON)
In this example we will show you how to convert java object to JSON using Gson library. Gson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON string to an equivalent Java object.