Check out example codes for "serialize a pojo to json with gson stackoverflow". It will help you in understanding the concepts better.

Code Example 1

Pojo myPojo = new Pojo();

Gson gson = new Gson();
gson.toJson(myPojo);

Learn ReactJs, React Native from akashmittal.com