This post originated from an RSS feed registered with Java Buzz
by Arpit Mandliya.
Original Post: Gson fromJson example
Feed Title: Java tutorial for beginners
Feed URL: http://feeds.feedburner.com/arpitmandliyasblog
Feed Description: A blog about java programming language and its frameworks
In this post, we will see about Gson fromJson example.We have already seen simple Gson example in the previous post. Gson fromJson method is used to convert JSON String or JsonObject or Reader to the corresponding object. You can read about various variants about fromJson method over Gson page. I will demonstrate Gson fromJson method with help of example. Read simple JSON String You can use fromJson(String json, Class classOfT) method to read simple Json string. Let’s say you have Country class as below. Create a class named “SimpleGsonMain” When you run above program, you will get below