You can put your JSON data in a variable:

data = {"sensors":
        {"-KqYN_VeXCh8CZQFRusI":
            {"bathroom_temp": 16,
             "date": "02/08/2017",
             "fridge_level": 8,
             "kitchen_temp": 18,
             "living_temp": 17,
             "power_bathroom": 0,
             "power_bathroom_value": 0,
             "power_kit_0": 0
        },
        "-KqYPPffaTpft7B72Ow9":
            {"bathroom_temp": 20,
             "date": "02/08/2017",
             "fridge_level": 19,
             "kitchen_temp": 14,
             "living_temp": 20,
             "power_bathroom": 0,
             "power_bathroom_value": 0
        },
        "-KqYPUld3AOve8hnpnOy":
            {"bathroom_temp": 23,
             "date": "02/08/2017",
             "fridge_level": 40,
             "kitchen_temp": 11,
             "living_temp": 10,
             "power_bathroom": 1,
             "power_bathroom_value": 81,
        }
    }
}

and then use a nested index address for getting the desired parameter:

kitchen_temp = data["sensors"]["-KqYN_VeXCh8CZQFRusI"]["kitchen_temp"]
print(kitchen_temp)
Answer from nima on Stack Overflow
๐ŸŒ
Medium
medium.com โ€บ @ferzia_firdousi โ€บ multi-level-nested-json-82d29dd9528
Multi-level Nested JSON
May 3, 2023 - Multi-level Nested JSON Recently, I went down a rabbit hole, trying to figure out JSON file parsing in Python from the Jupyter Notebook platform. After extensive reading and experimenting, I finally โ€ฆ
Discussions

parse multi-level json in python

hey so I know this is kind of weird to point out, but it looks like you're using Azure... so SQL Server

SQL Server has native JSON parsing functions. https://docs.microsoft.com/en-us/sql/relational-databases/json/json-data-sql-server?view=sql-server-2017

You might be able to save yourself a ton of headaches.

More on reddit.com
๐ŸŒ r/Python
4
0
August 22, 2019
python - JSON parsing with multiple nested levels - Stack Overflow
We have source JSON with multiple nested levels that need to be flattened and then inserted into a relational table. The problem here is that we have multiple objects being returned with varying n... More on stackoverflow.com
๐ŸŒ stackoverflow.com
python - parse JSON values by multilevel keys - Stack Overflow
Yesterday, I have started with learning python. I want to parse some JSON values now. I have read many of tutorials and spent a lot of time on getting values by multilevel key (if I can call it lik... More on stackoverflow.com
๐ŸŒ stackoverflow.com
April 18, 2017
Parsing Json with multiple "levels" with Python - Stack Overflow
I'm trying to parse a json file from an api call. I have found this code that fits my need and trying to adapt it to what I want: import math, urllib2, json, re def download(): graph = {} ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
December 27, 2017
๐ŸŒ
Bcmullins
bcmullins.github.io โ€บ parsing-json-python
Parsing Nested JSON Records in Python - Brett Mullins โ€“ Researcher - Data Scientist
If the input is a list of dictionary, a list of lists is returned. obj - list or dict - input dictionary or list of dictionaries path - list - list of strings that form the path to the desired element ''' def extract(obj, path, ind, arr): ''' Extracts an element from a nested dictionary along a specified path and returns a list. obj - dict - input dictionary path - list - list of strings that form the JSON path ind - int - starting index arr - list - output list ''' key = path[ind] if ind + 1 < len(path): if isinstance(obj, dict): if key in obj.keys(): extract(obj.get(key), path, ind + 1, arr)
๐ŸŒ
Pybites
pybit.es โ€บ articles โ€บ case-study-how-to-parse-nested-json
Case Study: How To Parse Nested JSON - Pybites
June 3, 2022 - This article will guide you through the necessary steps to parse this JSON response into a pandas DataFrame. I will focus heavily on the concepts and code development and less on explaining each line of code. Ideally, you should be already familiar with at least a little Python and its standard data types, most importantly dictionaries.
๐ŸŒ
Reddit
reddit.com โ€บ r/python โ€บ parse multi-level json in python
r/Python on Reddit: parse multi-level json in python
August 22, 2019 -

Python is not my goto, so sorry if this is a FAQ question. I need to parse json down a few levels and pull out some relevant data to push into a database for analysis. I see examples using both the native json, and ijson, but none that parse more than the first level.

So here is the sample json, munged a bit:

{
    "value1": "walterwhite",
    "value2": "school teacher",
    "services": [
        {
            "name": "first sub",
            "slug": "ovp",
            "vendors": [
                {
                    "slug": "wistia",
                    "name": "Wistia"
                }
            ],
            "vendor_count": 1
        },
        {
            "name": "second sub",
            "slug": "hosting",
            "vendors": [
                {
                    "slug": "013-netvision",
                    "name": "013 Netvision"
                },
                {
                    "slug": "internap",
                    "name": "Internap Corp."
                },
                {
                    "slug": "eurofiber",
                    "name": "Eurofiber"
                },
                {
                    "slug": "register-com--2",
                    "name": "Register.com"
                }
            ],
            "vendor_count": 4
          }
        ]
      }

i want to return:

a) All "services.name" ie. "first sub"

b) All "vendors.name" (under services) ie. "wistia"

Many thanks!

๐ŸŒ
PYnative
pynative.com โ€บ home โ€บ python โ€บ json โ€บ python parse multiple json objects from file
Python Parse multiple JSON objects from file | Solve ValueError: Extra data
May 14, 2021 - To parse a JSON file with multiple JSON objects read one JSON object at a time and Convert it into Python dict using a json.loads()
๐ŸŒ
Hackers and Slackers
hackersandslackers.com โ€บ extract-data-from-complex-json-python
Extract Nested Data From Complex JSON
December 22, 2022 - To use a better example, I recently used our json_extract() function to fetch lists of column names and their data types from a database schema. As separate lists, the data looked something like this: column_names = ['index', 'first_name', 'last_name', 'join_date'] column_datatypes = ['integer', ...
๐ŸŒ
Zyte
zyte.com โ€บ home โ€บ blog โ€บ json parsing with python [practical guide]
A Practical Guide to JSON Parsing with Python
July 6, 2023 - Learn how to parse flat and nested JSON data with Python. This guide covers libraries, methods, and advanced json parsers like JMESPath and ChompJS.
Find elsewhere
๐ŸŒ
Medium
ankushkunwar7777.medium.com โ€บ get-data-from-large-nested-json-file-cf1146aa8c9e
Working With Large Nested JSON Data | by Ankush kunwar | Medium
January 8, 2023 - You can access the data in the dictionary like this: name = data['name'] age = data['age'] city = data['city'] To extract data from a nested JSON object using recursion, you can use a function that iterates through the object and extracts the desired values. Here is an example of how you might ...
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 49457930 โ€บ json-parsing-with-multiple-nested-levels
python - JSON parsing with multiple nested levels - Stack Overflow
def recursive_object_to_table(json, prefix=''): for key in json: new_key = prefix + key if type(json[key]) is not dict: if new_key not in table: table[new_key] = [] table[new_key].append(json[key]) else: recursive_object_to_table(json[key], new_key + '_') ... Find the answer to your question by asking. Ask question ... See similar questions with these tags. ... Upcoming initiatives on Stack Overflow and across the Stack Exchange network... ... (Jeremiah 44 to 51) God's declarations of punishment for many ancient biblical nations But gives restoration/redemption/relief to some, but Not others ยท Path MTU on Linux when there are multiple routes with different MTUs
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 47981652 โ€บ parsing-json-with-multiple-levels-with-python
Parsing Json with multiple "levels" with Python - Stack Overflow
December 27, 2017 - Now the problem is that there is multiple level in the json "Result > 0, 1,2 etc" json screenshot ยท Copyfor key in jsrates['result'][0]['Ask']: I want the zero to be able to be any number, I don't know if thats clear. So I could get all the ask price to match their marketname. I have shortened the code so it doesnt make too long of a post. Thanks PS: sorry for the english, its not my native language. python ยท json ยท parsing ยท
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 70013794 โ€บ parse-multiple-level-of-json-in-python
arrays - Parse multiple level of JSON in Python - Stack Overflow
November 18, 2021 - I'm trying to parse item and put it in same level of products and if item has multiple values I would get multiple product with same item_id and etc. data = event['products']['item'] item =...
๐ŸŒ
freeCodeCamp
freecodecamp.org โ€บ news โ€บ how-to-parse-json-in-python-with-examples
How to Parse JSON in Python โ€“ A Complete Guide With Examples
October 29, 2025 - You can drill down as many levels as needed, like weather["current"]["wind"]["speed_mph"] which traverses three levels deep. This chaining syntax mirrors how you would access the data in the original JSON structure. JSON arrays represent ordered lists of values and appear frequently in API ...
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 55535321 โ€บ parse-multi-level-json-python
Parse Multi-Level JSON Python - Stack Overflow
April 5, 2019 - The structure returned by json.load is a nested Python dict. To iterate over the keys, you iterate over the dict itself. To iterate over just the values, iterate over dict.values(). To iterate over the keys and values in pairs iterate over dict.items().
๐ŸŒ
Towards Data Science
towardsdatascience.com โ€บ home โ€บ latest โ€บ how to extract nested dictionary data in python?
How to extract Nested Dictionary Data in Python? | Towards Data Science
March 5, 2025 - The filenames are single_json.py and multiple_json.py. In this example, weโ€™ll start by extracting data using a combination of list and dictionary extraction techniques as shown in the preceding table. In the Python code below, I start by providing the logic to import the data, the solution ...
๐ŸŒ
Quora
quora.com โ€บ What-is-the-best-way-to-parse-a-nested-JSON-structure-using-Python
What is the best way to parse a nested JSON structure using Python? - Quora
Answer: Without knowing the nature of the data or the type of structure, you should simply use json.loads to load the document to a Python object and then examine its contents in a debugger.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ how-to-parse-nested-json-in-python
How to Parse Nested JSON in Python - GeeksforGeeks
July 23, 2025 - This approach is ideal when the structure of JSON is fixed and known in advance. In this example, the parse_json function uses recursion to traverse the nested JSON structure and create a flattened dictionary.