Using Gson to load a JSON file from disk.

suggest change

This will load a JSON file from disk and convert it to the given type.

public static <T> T getFile(String fileName, Class<T> type) throws FileNotFoundException {
    Gson gson = new GsonBuilder()
            .create();
    FileReader json = new FileReader(fileName);
    return gson.fromJson(json, type);
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Handling JSON with Gson:
*Using Gson to load a JSON file from disk.

Table Of Contents
106Handling JSON with Gson
169XMPP
230AIDL
242Okio