From the course: Python: Working with Files

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Parse JSON files with Python

Parse JSON files with Python - Python Tutorial

From the course: Python: Working with Files

Parse JSON files with Python

- As a software engineer you'll likely have to work with different types of files and data, not just plain text files. JSON is a popular format for representing structured data. It's commonly used by APIs as well as for other data transfers. JSON stands for JavaScript Object Notation, and the data is represented with name-value pairs. These name-value pairs are separated by commas. For more complicated values, objects are represented through curly brackets and square brackets are used for race. Python provides a JSON module for working with JSON data. With the JSON module, we can load a given JSON file and work with it. As a JSON object in our program. Let's create a function that displays a JSON object from a file. The file will be working with monster.json is on our desktop, the same place as the script we're using. We'll open up the JSON file as F and this will automatically open the file in read mode. Read…

Contents