Last active
December 25, 2015 07:29
-
-
Save zlalanne/6939255 to your computer and use it in GitHub Desktop.
Quick function to load json from a file in python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def load_json_data(json_filename): | |
""" | |
Load a *.json file into a Python dictionary | |
@param json_filename: path to the json file | |
@return: a dictionary containing the data | |
""" | |
json_file = open(json_filename) | |
json_data = json_file.read() | |
test_data = json.loads(json_data) | |
json_file.close() | |
return test_data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment