Function to create json file
Pernelle Marone-Hitz
Member, Moderator, Employee Posts: 871
✭✭✭✭
Answers
-
The following function can be used:
import os def DumpToJson(dict, filePath): ''' Dump dictionnary to .json file ''' try: with io.open(filePath, "w", encoding="utf8") as json_file: json.dump(dict, json_file, ensure_ascii=False) return True except: ExtAPI.Log.WriteMessage("Error : Exception in DumpToJson()") return False
2