I found a quick and easy solution to what I wanted using json_normalize() included in pandas 1.01.

from urllib2 import Request, urlopen
import json

import pandas as pd    

path1 = '42.974049,-81.205203|42.974298,-81.195755'
request=Request('http://maps.googleapis.com/maps/api/elevation/json?locations='+path1+'&sensor=false')
response = urlopen(request)
elevations = response.read()
data = json.loads(elevations)
df = pd.json_normalize(data['results'])

This gives a nice flattened dataframe with the json data that I got from the Google Maps API.

Answer from pbreach on Stack Overflow
🌐
Pandas
pandas.pydata.org › docs › reference › api › pandas.read_json.html
pandas.read_json — pandas 3.0.1 documentation
This method reads JSON files or JSON-like data and converts them into pandas objects. It supports a variety of input formats, including line-delimited JSON, compressed files, and various data representations (table, records, index-based, etc.).
🌐
GeeksforGeeks
geeksforgeeks.org › python › pandas-parsing-json-dataset
Pandas - Parsing JSON Dataset - GeeksforGeeks
July 11, 2025 - To turn deeply nested JSON into a table use json_normalize() from pandas making it easier to analyze or manipulate in a table format. json.load(f): Loads the raw JSON into a Python dictionary.
People also ask

How to parse JSON strings in Python
To parse a JSON string in Python, we can use the built-in **`json`** module. This module provides two methods for working with JSON data: - **`json.loads()`** parses a JSON string and returns a Python object. - **`json.dumps()`** takes a Python object and returns a JSON string.
🌐
blog.apify.com
blog.apify.com › how-to-parse-json-with-python
How to parse JSON with Python
How to Read and Parse JSON files in Python
To parse a JSON file in Python, we can use the same json module we used in the previous section. The only difference is that instead of passing a JSON string to json.loads(), we pass the contents of a JSON file.
🌐
blog.apify.com
blog.apify.com › how-to-parse-json-with-python
How to parse JSON with Python
How to Pretty Print JSON data in Python
When working with JSON data in Python, it can often be helpful to pretty print the data, which means to format it in a more human-readable way. The json module provides a method called json.dumps() that can be used to pretty print JSON data.
🌐
blog.apify.com
blog.apify.com › how-to-parse-json-with-python
How to parse JSON with Python
🌐
W3Schools
w3schools.com › python › pandas › pandas_json.asp
Pandas Read JSON
If your JSON code is not in a file, but in a Python Dictionary, you can load it into a DataFrame directly: ... import pandas as pd data = { "Duration":{ "0":60, "1":60, "2":60, "3":45, "4":45, "5":60 }, "Pulse":{ "0":110, "1":117, "2":103, "3":109, "4":117, "5":102 }, "Maxpulse":{ "0":130, "1":145, "2":135, "3":175, "4":148, "5":127 }, "Calories":{ "0":409, "1":479, "2":340, "3":282, "4":406, "5":300 } } df = pd.DataFrame(data) print(df) Try it Yourself »
Top answer
1 of 6
71

I think applying the json.loads is a good idea, but from there you can simply directly convert it to dataframe columns instead of writing/loading it again:

stdf = df['stats'].apply(json.loads)
pd.DataFrame(stdf.tolist()) # or stdf.apply(pd.Series)

or alternatively in one step:

df.join(df['stats'].apply(json.loads).apply(pd.Series))
2 of 6
57

There is a slightly easier way, but ultimately you'll have to call json.loads There is a notion of a converter in pandas.read_csv

converters : dict. optional

Dict of functions for converting values in certain columns. Keys can either be integers or column labels

So first define your custom parser. In this case the below should work:

def CustomParser(data):
    import json
    j1 = json.loads(data)
    return j1

In your case you'll have something like:

df = pandas.read_csv(f1, converters={'stats':CustomParser},header=0)

We are telling read_csv to read the data in the standard way, but for the stats column use our custom parsers. This will make the stats column a dict

From here, we can use a little hack to directly append these columns in one step with the appropriate column names. This will only work for regular data (the json object needs to have 3 values or at least missing values need to be handled in our CustomParser)

df[sorted(df['stats'][0].keys())] = df['stats'].apply(pandas.Series)

On the Left Hand Side, we get the new column names from the keys of the element of the stats column. Each element in the stats column is a dictionary. So we are doing a bulk assign. On the Right Hand Side, we break up the 'stats' column using apply to make a data frame out of each key/value pair.

🌐
Reddit
reddit.com › r/learnpython › why parse json with python when pandas exists?
r/learnpython on Reddit: Why Parse JSON With Python When Pandas Exists?
December 28, 2023 -

Doing it with pure Python is interesting. It's incredibly flexible. It's time consuming. Is it silly?

I'm generally up for doing things the native way just because it's clean. But am I being silly not abstracting it away with some package? I was using a flavor of SQL I rarely touch the other day and was told "now with JSON support" and it actually wasn't terrible. SQL isn't exactly a bastion of exclusively new thinking. If we've already eliminated actual javascript for dealing with its JSON, why stop there? I am becoming a back in the good ole days when we used horses type of ass?

🌐
Apify
blog.apify.com › how-to-parse-json-with-python
How to parse JSON with Python
March 11, 2025 - Learn to parse JSON strings with Python's built-in json module and convert JSON files using pandas.
Find elsewhere
🌐
Python Basics
pythonbasics.org › pandas-json
JSON with Python Pandas - Python Tutorial
Read json string files in pandas read_json(). You can do this for URLS, files, compressed files and anything that’s in json format. In this post, you will learn how to do that with Python.
🌐
Numpyninja
numpyninja.com › post › parsing-json-dataset-using-pandas
Parsing JSON dataset using Pandas
Advanced healthcare technology platform leveraging AI to revolutionize medical information dissemination and patient insights through comprehensive, data-driven content strategies.
Top answer
1 of 2
1
>>> df = pd.DataFrame([['a', 'b'], ['c', 'd']],
...                   index=['row 1', 'row 2'],
...                   columns=['col 1', 'col 2'])

Encoding/decoding a Dataframe using 'split' formatted JSON:

>>> df.to_json(orient='split')
'{"columns":["col 1","col 2"],
  "index":["row 1","row 2"],
  "data":[["a","b"],["c","d"]]}'
>>> pd.read_json(_, orient='split')
      col 1 col 2
row 1     a     b
row 2     c     d

Encoding/decoding a Dataframe using 'index' formatted JSON:

>>> df.to_json(orient='index')
'{"row 1":{"col 1":"a","col 2":"b"},"row 2":{"col 1":"c","col 2":"d"}}'
>>> pd.read_json(_, orient='index')
      col 1 col 2
row 1     a     b
row 2     c     d

Encoding/decoding a Dataframe using 'records' formatted JSON. Note that index labels are not preserved with this encoding.

>>> df.to_json(orient='records')
'[{"col 1":"a","col 2":"b"},{"col 1":"c","col 2":"d"}]'
>>> pd.read_json(_, orient='records')
  col 1 col 2
0     a     b
1     c     d

Encoding with Table Schema

>>> df.to_json(orient='table')
'{"schema": {"fields": [{"name": "index", "type": "string"},
                        {"name": "col 1", "type": "string"},
                        {"name": "col 2", "type": "string"}],
                "primaryKey": "index",`enter code here`
                "pandas_version": "0.20.0"},
    "data": [{"index": "row 1", "col 1": "a", "col 2": "b"},
            {"index": "row 2", "col 1": "c", "col 2": "d"}]}'
2 of 2
1

Your json is invalid. The value for the Test key is missing the starting '{'. It should be:

data = [{
 "Name": {
        "Name": "abc xyz",
"email": "[email protected]",
"website": "www.abc.me",
"github": "https://github.com/abc",
"address": "abc"
},
    "Test":{ 
        "Name": "abc xyz",
"email": "[email protected]",
"website": "www.abc.me",
"github": "https://github.com/abc",
"address": "abc"
}
}]

This can then be directly loaded into pandas as follows:

pd.DataFrame(data[0])
                           Name                    Test
Name                    abc xyz                 abc xyz
address                     abc                     abc
email             [email protected]           [email protected]
github   https://github.com/abc  https://github.com/abc
website              www.abc.me              www.abc.me
🌐
Medium
medium.com › @dimasigit › how-to-parsing-json-using-pandas-71e54110b244
How to parsing JSON using Pandas
October 3, 2023 - With this code, you obtain a new ... 'orchestra', 'programID', and 'season' from higher levels in the JSON. This makes data analysis and manipulation easier in Python. ... If you notice, when we parse the ‘works’ and ‘concerts’ columns, there is a differen...
🌐
Spark By {Examples}
sparkbyexamples.com › home › pandas › pandas read json file with examples
Pandas Read JSON File with Examples - Spark By {Examples}
January 10, 2025 - If you have a JSON in a string, you can read or load this into pandas DataFrame using read_json() function.
🌐
Swdevnotes
swdevnotes.com › python › 2022 › extract-data-from-json-in-pandas-dataframe
Extract data from JSON in Pandas Dataframe | Software Development Notes
This is easily overcome by using the built-in json module to load the string as a Python Dictionary. 1json_string = '{"color": "Red", "wavelength": "620 to 750 nm"}' 2error_dict = dict(json_string) 3 4>>> # ValueError: dictionary update sequence element #0 has length 1; 2 is required
🌐
Stack Abuse
stackabuse.com › reading-and-writing-json-files-in-python-with-pandas
Reading and Writing JSON Files in Python with Pandas
September 7, 2023 - In this article, we've covered how to read and write JSON files using Python's popular Pandas library - from local to remote files.
🌐
KDnuggets
kdnuggets.com › how-to-convert-json-data-into-a-dataframe-with-pandas
How to Convert JSON Data into a DataFrame with Pandas - KDnuggets
The easiest and most straightforward approach is to use the built-in json.load() function to parse our JSON data. This will convert it into a Python dictionary, and we can then create the DataFrame directly from the resulting Python data structure.
🌐
Spark By {Examples}
sparkbyexamples.com › home › pandas › pandas convert json to dataframe
Pandas Convert JSON to DataFrame - Spark By {Examples}
July 3, 2025 - You can convert JSON to pandas DataFrame by using json_normalize(), read_json() and from_dict() functions. Some of these methods are also used to extract
🌐
Medium
medium.com › data-science › how-to-parse-json-data-with-python-pandas-f84fbd0b1025
How to parse JSON data with Python Pandas? | by Ankit Goel | TDS Archive | Medium
November 19, 2024 - One-liner to read and normalize JSON data into a flat table using Python Pandas. Now, you can use JSON data to load into Excel or generate reports.
🌐
Saturn Cloud
saturncloud.io › blog › python-pandas-json-to-dataframe
Python Pandas Json to DataFrame | Saturn Cloud Blog
February 3, 2024 - Ease of Use: The read_json() function in Pandas simplifies the process of converting JSON data to a Pandas DataFrame, requiring just a single line of code. Versatility: The function can read JSON data from both files and URLs, providing flexibility ...