Coding Global Background
Coding Global

Problem with gson.fromJson()

Archived 2 years ago
24 messages
1 members
Created 2 years ago
Updated 2 years ago
Open in Discord
S
Splayfer
Hello together,
i just want to read a json object from a .json file using gson.fromJson(reader, Type.class) but it doesnt work :(

    public void doSomething() throws IOException {
        Gson gson = new Gson();

        BrawlPlayer[] array = gson.fromJson(new FileReader("PATH"), BrawlPlayer[].class);
    }


The return value for the fromJson() function is always null. I'm getting no errors even with try catch and writing values works just fine but reading doesnt

Replies (24)