Listing 09-15: Reading a JSON file

##############################################################################
# Python From Scratch
# Autor: Nilo Ney Coutinho Menezes
# Editora Novatec (c) 2010-2024
# Site: https://pythonfromscratch.com
#
# File: listing\chapter 09\09.15 - Reading a JSON file.py
# Description: Reading a JSON file
##############################################################################

import json
from pathlib import Path
with Path("data.json").open() as file:
    data = json.load(file)
print(data["name"])
print(data["values"])
Click here to download the file