How to convert JSON into object?
To convert JSON string to object use
Gson.fromJson() method. This method takes the JSON string and the object type of the string to be converted.
This example will print the following result:
student.getName() = Duke
student.getAddress() = Menlo Park
student.getDateOfBirth() = Tue Feb 01 00:00:00 CST 2000
You can find the
Student class on the previous example mentioned at the beginning of this example.