Package ch.epfl.cs107.play.data.json
Class JSONParser
java.lang.Object
ch.epfl.cs107.play.data.json.JSONParser
Used to read JSON files and write to JSON files
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic JSONObjectreadJSONFromFile(String path) Used to read JSON files and get their contents as a JSONObjectstatic voidwriteJSONToFile(String path, JSONObject json) Used to write a JSONObject to a file
-
Constructor Details
-
JSONParser
public JSONParser()
-
-
Method Details
-
readJSONFromFile
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
Used to write a JSONObject to a file- Parameters:
path- (String): the path to the filejson- (JSONObject): the JSONObject to write
-