Advertisement
Guest User

Untitled

a guest
Jul 20th, 2023
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var loaded_json_file
  2.  
  3. #When loading the .json file.
  4. func load_json(path_string):
  5.     var dir =  Directory.new()
  6.     if dir.file_exists(path_string) == true:
  7.         var file = File.new()
  8.         file.open(path_string, File.READ)
  9.         loaded_json_file = JSON.parse(file.get_as_text()).result
  10.         file.close()
  11.  
  12. #When saving the .json file, passing the .json files full path.
  13. func save_json(path_string):
  14.     var file.new()
  15.     file.open(path_string)
  16.     file.store_line(to_json(loaded_json_file))
  17.     file.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement