How to Read JSON Files with Pandas? Last Updated : 13 May, 2025 Comments Improve Suggest changes Like Article Like Report JSON (JavaScript Object Notation) store data using key-value pairs. Reading JSON files using Pandas is simple and helpful when you're working with data in .json format. There are mainly three methods to read Json file using Pandas Some of them are:Using pd.read_json() MethodUsing JSON Module and pd.json_normalize() MethodUsing pd.Dataframe() Methods1. Using pd.read_json() to Read JSON Files in PandasThe pd.read_json() function helps to read JSON data directly into a DataFrame. This method is used when we working with standard JSON structures. If the file is located on a remote server we can also pass the URL instead of a local file path. Let’s say you have a file named data.json with the following content:[ {"id": 1, "name": "Alice", "age": 25}, {"id": 2, "name": "Bob", "age": 30}, {"id": 3, "name": "Charlie", "age": 22}]You can read this JSON file using the code below: Python import pandas as pd df = pd.read_json('data.json') print(df.head()) Output: 2. Using json Module and pd.json_normalize() methodThe json_normalize() is used when we are working with nested JSON structues. JSON from APIs often comes in nested form and this method helps to flatten it into a tabular format that’s easier to work with in Pandas. This method is helpful when working with real-world JSON responses from APIs. Python import pandas as pd import json data = {"One": {"0": 60, "1": 60, "2": 60, "3": 45, "4": 45, "5": 60}, "Two": {"0": 110, "1": 117, "2": 103, "3": 109, "4": 117, "5": 102}} json_data = json.dumps(data) df_normalize = pd.json_normalize(json.loads(json_data)) print("\nDataFrame using JSON module and `pd.json_normalize()` method:") df_normalize Output: 3. Using pd.DataFrame with a DictionaryIf JSON data is stored as a dictionary we can directly use pd.DataFrame() convert it into a structured DataFrame. This is helpful when you are working with pre-loaded or manually created JSON data in memory. Python import pandas as pd df = pd.DataFrame(data) print(df) Output: These methods help you to use JSON data into Pandas for analysis and visualization. With just a few lines of code you can turn raw JSON into a clean and usable DataFrame. Comment More infoAdvertise with us Next Article How to Read JSON Files with Pandas? P prat0 Follow Improve Article Tags : Python Python-pandas Python pandas-io Practice Tags : python Similar Reads How to Read Text Files with Pandas? In this article, we will discuss how to read text files with pandas in Python. In Python, the Pandas module allows us to load DataFrames from external files and work on them. The dataset can be in different types of files.Text File UsedRead Text Files with PandasBelow are the methods by which we can 6 min read Reading rpt files with Pandas In most cases, we usually have a CSV file to load the data from, but there are other formats such as JSON, rpt, TSV, etc. that can be used to store data. Pandas provide us with the utility to load data from them. In this article, we'll see how we can load data from an rpt file with the use of Pandas 2 min read How to read JSON files in R JSON (JavaScript Object Notation) is a lightweight data-interchange format that is easy to read for humans as well as machines to parse and generate. It's widely used for APIs, web services and data storage. A JSON structure looks like this:{ "name": "John", "age": 30, "city": "New York"}JSON data c 2 min read How to read this JSON file with jsonlite in R? JSON data is represented as key-value pairs, which are similar to the concept of a dictionary in Python or a list of named elements in R. In this article, we will learn how to access different components of a JSON file using R. What is jsonlite package in R? The jsonlite package in R provides an eas 2 min read How to Open JSON File? JSON (JavaScript Object Notation) is a lightweight, text-based data format that stores and exchanges data. Let's see how we can create and open a JSON file.How to Create JSON Files?Before learning how to open a JSON file, it's important to know how to create one. Below are the basic steps to create 2 min read Like