Convert Java Collection / List / String[] Array Into JSON

In this example, we are going to convert a Java collection/list/string[] array into appropriate JSON String using GSON library


I have already written an article about GSON, Convert Java Object To / From JSON, GSON Example, Please see it

Convert Java Object To / From JSON, GSON Example

On this Simple GSON Example explains about converting a Java Object to JSON string nad JSON string to Java Object Using Google Gson JSON library

Google 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. Gson can work with arbitrary Java objects including pre-existing objects that you do not have source-code of.

Reference ->

Here I am showing an example about How to convert a Java Object into JSON string and vice versa using Google Gson.