Convert Java Object to Json using GSON
1. Create a maven project in eclipse and use pom.xml to add GSON dependencies.
2. Create a Plain Old Java Object (POJO) that is to be converted into Json. Consider the following java code to create the java object.
3. Create a java class that uses Gson class to convert the Company object to Json.
4. We will get the JSON object upon executing the ConvertJSON class. The generated JSON string is given below.