Lesson 20Processing JSON Files
This is the third lesson on working with files using Python. In the previous two lessons, we learned about working with basic text files and with CSV files. In this lesson, the focus shifts to working with JSON files, which can represent unstructured datasets and with key:value pairs. Like with the other file formats, we can use Python scripts to read JSON files, add (or append) content to an existing file, and create new files.
PROCESSING JSON FILES
Python has a built-in package called JavaScript Object Notation (JSON), which can be used to work with JSON data. The abbreviation is pronounced like the name “Jason.” We use JSON to store unstructured datasets in a format that allows us to transfer data from one system to another, in the same way we use CSV to transfer structured datasets.
We say that JSON is unstructured because we can create records ...
Get Job Ready Python now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.