Reading json file using python

Reading json file using python is very easy. You can easily read your json file within two lines of code.

Below is the json file format –

{
"data1": "value1",
"data2": "value2"
}

Code to read above json file –

import json
with open('bytesdecoder.json') as json_file:
object_json = json.load(json_file)
print(object_json)

Output –

{‘data1’: ‘value1’, ‘data2’: ‘value2’}