I thought this would be simple but it keeps crashing with InvocationTargetException at reader.hasNext().
File jsonInputFile = new File(root + "/dicts/phrases.json");
JsonReader reader = new JsonReader(new FileReader(jsonInputFile));
while (reader.hasNext()) {
System.out.println(reader.nextName());
}
What exactly is wrong with this? The while loop just goes on forever despite the json file only have one line.
Since it seems to be reading the JSON and it is encountering a BEGIN_TOKEN rather than JsonToken.NAME type
Could you try the below: