From the course: Hands-On Introduction: Python

Unlock the full course today

Join today to access over 24,200 courses taught by industry experts.

Outputting JSON

Outputting JSON

- [Instructor] In this movie, we're going to turn some CSV data into some JSON data using Python magic. So CSV is very useful, especially when dealing with Excel and other spreadsheet software. However, JSON is far more popular in modern application development. It's used in APIs. Many modern databases used JSON or similar formats to store data. And lucky for us, Python comes with a great JSON module that packs in a great deal of utility. So here I am in my code space in Ex_files 03_03_begin main.py. And on line one, you'll notice that I import CSV that's going to allow me to read my CSV data. Then I import JSON, which is the JSON module. On line three, I bring in pretty-print or pprint. That's going to allow me to put things in a neat way to the console when I print. Then I define a dictionary with facts about Albert Einstein and this is not JSON yet. This is a Python dictionary. It looks a lot like JSON. In order…

Contents