Class JSONParser

java.lang.Object
ch.epfl.cs107.play.data.json.JSONParser

public class JSONParser extends Object
Used to read JSON files and write to JSON files
  • Constructor Details

    • JSONParser

      public JSONParser()
  • Method Details

    • readJSONFromFile

      public static JSONObject readJSONFromFile(String path)
      Used to read JSON files and get their contents as a JSONObject
      Parameters:
      path - (String): the path to the file
      Returns:
      (JSONObject): the contents of the file
    • writeJSONToFile

      public static void writeJSONToFile(String path, JSONObject json)
      Used to write a JSONObject to a file
      Parameters:
      path - (String): the path to the file
      json - (JSONObject): the JSONObject to write