Links

Read json file

Tags: #python #json #read #file #data #parse
Description: This notebook will demonstrate how to read a json file in Python.
References:

Input

Import libraries

import json

Setup Variables

  • file_name: Name of the json file to be read
file_name = "data.json"

Model

Read json file

This function will read the json file and return the content as a dictionary.
def read_json_file(file_name):
with open(file_name) as json_file:
data = json.load(json_file)
return data

Output

Display result

data = read_json_file(file_name)
print(data)