Python read JSON from file example

Language:
Python
12 views
0 favorites
2 hours ago

Code Implementation

Python
import json

# Open and read the JSON file
with open('data.json', 'r') as file:
    data = json.load(file)

# Print the parsed data
print(data)

The simplest code snippet for reading a JSON file using Python, implemented with the built-in json module.

#json

Snippet Description

You can also use json.dumps() for indentation control.

Comments

Loading...