Lesson 07: Nested Data Structures
Lists, tuples, and dictionaries can store other lists, tuples and dictionaries as values. These nested data structures allow one to store complex object representations. This week, you will learn how to access values stored in nested data structures.
You will also learn how to use the json
module to both read and write JSON documents, a
standard data interchange format. You will also learn how to use the json
module to both read and write JSON documents.
Readings
Below are a set of readings that you should consider reviewing. Note that the Real Python articles referenced below may require signing up for a free account.
1.0 Required
Eric Matthes, Python Crash Course, 3rd Edition (No Starch Press, 2023).
Read the final section in Chapter 6 Dictionaries:
Lindsey Basset, Introduction to Javascript Object Notation (O’Reilly Media, Inc., 2015).
Review the following chapters:
- Chapter 1 What is JSON.
- Chapter 2 JSON Syntax.
- Chapter 3 JSON Data Types.
Chapter 1 is a quick read. Chapters 2 and 3 describe how to craft JSON documents and the data types that can be expressed as values.
2.0 Recommended
Philipp Acsany, Working With JSON Data in Python (Real Python, Jul 2024).
Comprehensive guide to working with JSON data in Python.
Tommaso De Ponti, How to Work with JSON Files in Python (BetterProgramming, Mar 2020).
Discusses reading from and writing to JSON files using the Python Standard Library’s json
module.