pyrevitlabs / pyRevit

Rapid Application Development (RAD) Environment for Autodesk Revit®
http://wiki.pyrevitlabs.io
GNU General Public License v3.0
1.33k stars 338 forks source link

script.load_json returns string instead of object #995

Closed sweco-begertjanvdb closed 4 years ago

sweco-begertjanvdb commented 4 years ago

Description / Explanation Seems like the script.load_json method returns just returns the data of a file as a string. Not as an object

file_loc = script.get_instance_data_file('temp, False) data = {'somelist': ['item1', 'item2'], 'not a list' : 99} script.dump_json(data, file_loc)

loaded_data = script.load_json(file_loc)

I would expect loaded_data to be a dictionary, instead I just get the data as a string

Potential Fix PyRevit/script.py -> line 576 in the load_json method. replace: return json_file.read() with: return json.reads(json_file.read())

Desktop (please complete the following information):

anyway no big deal. Love your work. PyRevit is a dream!

htlcnn commented 4 years ago

@eirannejad this can be closed now