Skip to content

Instantly share code, notes, and snippets.

@zlalanne
Last active December 25, 2015 07:29
Show Gist options
  • Save zlalanne/6939255 to your computer and use it in GitHub Desktop.
Save zlalanne/6939255 to your computer and use it in GitHub Desktop.
Quick function to load json from a file in python
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