Tutorials References Exercises Bootcamp Menu
Sign Up Create Website Get Certified Pro

Pandas Read JSON


Big data sets are often stored, or extracted as JSON.

JSON is plain text, but has the format of an object, and is well known in the world of programming, including Pandas.

In our examples we will be using a JSON file called 'data.json'.

Open data.json.


Load the JSON file into a DataFrame:

import pandas as pd

df = pd.read_json('data.json')

Try it Yourself »

Tip: use to_string() to print the entire DataFrame.

Dictionary as JSON

JSON = Python Dictionary

JSON objects have the same format as Python dictionaries.

If your JSON code is not in a file, but in a Python Dictionary, you can load it into a DataFrame directly:


Load a Python Dictionary into a DataFrame:

import pandas as pd

data = {

df = pd.DataFrame(data)

Try it Yourself »

w3schools CERTIFIED . 2022

Get Certified!

Complete the Pandas modules, do the exercises, take the exam, and you will become w3schools certified!