Parse json string using Google Gson

Google Gson is very popular library to convert JSON to object and vice versa. The formJson(…) and toJson(…) are the two main APIs for the same. In this example we will see how to perform following JSON parsing operations using those APIs. 1. Convert a object to JSON string 2. Convert a list of objects to JSON string 3. Parse JSON string to convert to object 4. Parse JSON string to convert to List of objects Like the other examples, I am using gradle as build system.