Here you can find the source of load(String fileName, Class
public static <T> T load(String fileName, Class<T> klass) throws IOException
//package com.java2s; import java.io.File; import java.io.FileReader; import java.io.IOException; import com.google.gson.Gson; public class Main { public static <T> T load(String fileName, Class<T> klass) throws IOException { File file = new File(fileName); Gson gson = new Gson(); try (FileReader rdr = new FileReader(file)) { return gson.fromJson(rdr, klass); }//from w w w. j a va 2 s .co m } }