Skip to content

Latest commit

 

History

History
54 lines (32 loc) · 1.69 KB

Python_Read_json_file.md

File metadata and controls

54 lines (32 loc) · 1.69 KB



Template request | Bug report | Generate Data Product

Tags: #python #json #read #file #data #parse

Author: Sriniketh Jayasendil

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)