How to read a JSON file in Python

Crystal X
Geek Culture
Published in
5 min readSep 8, 2021

--

Ever since I have been studying data science, I have been working with csv files, which are comma separated values. I had known there are other types of file types that Python can work with, but I had always steered towards loading and reading csv files. One file that I found in Google Colab is anscombe.json. I never worked with this file because I wasn’t quite sure what to do with it. I decided there is no time like now to learn about json files, so that is the purpose of today’s project.

A json file is a file that stores simple data structures and objects in JavaScript Object Notation format, which is standard data exchange format. It is normally used for transmitting data between a web application and a server. Json files are lightweight, text based, human readable, and can be edited using a text editor.

Since pandas has a facility to read json files, I decided that I would have a stab at reading it. Because I was not sure how to do it, I had to research the internet to find out exactly how to read a json file.

The anscombe.json file can be found in the Google Colab program, as seen in the screenshot below:-

I also created a file to read the anscombe file because I did not know exactly what was in the file. According to Wikipedia, Anscombe’s quartet comprises four datasets that have nearly identical…

--

--

Crystal X
Geek Culture

I have over five decades experience in the world of work, being in fast food, the military, business, non-profits, and the healthcare sector.