GSON Installation

To use GSON in our Java application we need to include the GSON JAR file in the classpath of our Java application.

we can do so either by adding GSON as a Maven dependency to our project, or by downloading the JAR file and include it in the classpath manually.

>_ Downloading / Configuring GSON

Using Dependency's (Maven,Ivy,Grape etc..)

>_ For Maven

<dependency>
    <groupId>com.google.code.gson</groupId>
    <artifactId>gson</artifactId>
    <version>2.7</version>
</dependency>

>_ For Apache Buildr

'com.google.code.gson:gson:jar:2.7'

>_ For Apache Ivy

<dependency org="com.google.code.gson" name="gson" rev="2.7" />

>_ For Groovy Grape

@Grapes( 
@Grab(group='com.google.code.gson', module='gson', version='2.7') 
)

Remember to insert the version of GSON you plan to use

>_ How To Get The Updated GSON or Direct GSON Jar File

If we are not using Maven in our Java project then we can also download the GSON JAR file directly from the central Maven repositor.

Copyright © 2018-2020 TutorialToUs. All rights reserved.