import json


def saveData(data = [], path = "./data/save.json", mode = "rt"):
	"""Save data in a json file, or read a saved file

    Keyword arguments:
    data   -- Date to be saved, string|list|dictionnary
    path   -- Path to cache file
    mode   -- Reading or writing mode
	"""
	if mode == "wt":
		f = open(path, "wt")
		f.write(json.dumps(data))
		f.close()
		return True
	else:
		f = open(path, "rt")
		data = json.load(f)
		f.close()
		return data