Read json from File in python

From time to time I have to read some json data from a file and use it in python. It’s not too often, but everytime I have to take a look at a python script where I already have done it. Maybe with this blog post I can remember that two lines from now on In the end its pretty easy. Import json lib and read the file…

import json

with open('data-file.json') as data_file:    
    data = json.load(data_file)

comments powered by Disqus