diff options
-rw-r--r-- | src/main/persistance/JsonUtils.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/persistance/JsonUtils.java b/src/main/persistance/JsonUtils.java index 4e11a18..c97e5fd 100644 --- a/src/main/persistance/JsonUtils.java +++ b/src/main/persistance/JsonUtils.java @@ -29,11 +29,13 @@ public class JsonUtils { * REQUIRES: a path to a valid file containing JSONObject-serialized data * EFFECTS: reads a serialized String into a JSONObject */ - public static JSONArray readFromFile(String path) { + public static JSONArray readFromFile(String pathString) { String content; JSONArray deread; + Path path; try { - content = Files.readString(Paths.get(path)); + path = Paths.get(pathString); + content = new String(Files.readAllBytes(path)); deread = new JSONArray(content); } catch (Exception e) { System.out.println("Read from file failed with %s"); |