Coding Global Background
Coding Global

Problem with gson.fromJson()

Archiviert 2 years ago
24 Nachrichten
1 Mitglieder
Erstellt 2 years ago
Aktualisiert 2 years ago
In Discord öffnen
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

Antworten (24)