1
Pins

Creating JSON document using Java and GSON API

posted by anishaanisha 728 days, 2 hours, 37 minutes ago
Wednesday, July 25, 2012 1:26:39 PM GMT

We saw how to parse JSON using GSON API, in this post we would take a look at how the same GSON API can be used to create JSON from the Java objects. Please read this to get an idea of what GSON is. Diving right into the topic of this example, we would make use of the toJson method of com.google.gson.Gson class. One of the overloaded versions of toJson() takes in an source of type Object and the type information which is of class java.lang.reflect.Type. Lets define the model which would hold the data: c...

category: Java EE | clicked: 0 | | source: www.javabeat.net | show counter code
tags: API, GSON, Java, JSON


To post comments using your Facebook,Twitter, Gmail etc credentials in the Discus comments section. Or use your Javapins credentials at the end of the page.
To post your comment as a Javapins user please login or signup to Javapins database.