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
The problem here is that we have multiple objects being returned with varying nested levels. We are looking to build a generic JSON parser that flattens any JSON and inserts into a table. ... I want to design a blackbox where I just input the JSON and may be few parameters to flatten it out and then insert into corresponding tables for Type 1 and Type 2 Jsons. Is it possible to handle all possible cases within a python ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
January 6, 2023
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
Parse Multi-Level JSON Python - Stack Overflow
Communities for your favorite technologies. Explore all Collectives ยท Ask questions, find answers and collaborate at work with Stack Overflow for Teams More on stackoverflow.com
๐ŸŒ stackoverflow.com
April 5, 2019
๐ŸŒ
Pybites
pybit.es โ€บ articles โ€บ case-study-how-to-parse-nested-json
Case Study: How To Parse Nested JSON - Pybites
June 3, 2022 - This implementation might be naive and does not generalize at all to any other use case, but it is still a highly effective method to begin with because it forces you to explicitly state the JSON structure down to the last element. That this method works can be tested again with the pandas DataFrame class that can create a data frame from a dictionary that has a list of values for each column: ... However, aiming at a more general solution that can deal automatically with all attributes/properties without knowing the structure (but relying on the fact that there are only two levels of nested dictionaries, at least for now), I derived at the following solution:
๐ŸŒ
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 ...
๐ŸŒ
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!

๐ŸŒ
Bcmullins
bcmullins.github.io โ€บ parsing-json-python
Parsing Nested JSON Records in Python - Brett Mullins โ€“ Researcher - Data Scientist
This post provides a solution if one knows the path through the nested JSON to the desired information. ... { "employees": [ { "name": "Alice", "role": "dev", "nbr": 1 }, { "name": "Bob", "role": "dev", "nbr": 2 } ], "firm": { "name": "Charlie's Waffle Emporium", "location": "CA" } } This record ...
๐ŸŒ
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()
๐ŸŒ
Zyte
zyte.com โ€บ home โ€บ blog โ€บ json parsing with python [practical guide]
A Practical Guide to JSON Parsing with Python
July 6, 2023 - In the example above, there is an object 'car' inside the JSON structure that contains two mappings ('model' and 'year'). This is an example of a nested JSON structure where an object is contained within another object. Accessing elements within nested JSON structures requires using multiple ...
Find elsewhere
๐ŸŒ
Hackers and Slackers
hackersandslackers.com โ€บ extract-data-from-complex-json-python
Extract Nested Data From Complex JSON
December 22, 2022 - As separate lists, the data looked something like this: column_names = ['index', 'first_name', 'last_name', 'join_date'] column_datatypes = ['integer', 'string', 'string', 'date'] ... These two lists are directly related; the latter describes the former. How can this be useful?
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 49457930 โ€บ json-parsing-with-multiple-nested-levels
python - JSON parsing with multiple nested levels - Stack Overflow
January 6, 2023 - 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 ...
๐ŸŒ
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 - This will parse the JSON data and store it in a dictionary. 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 do this:
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 55535321 โ€บ parse-multi-level-json-python
Parse Multi-Level JSON Python - Stack Overflow
April 5, 2019 - JSON response - { "001": { "STUDENTTYPE": { "TYPE": "Boarder" }, "ACADEMICS": [ { "SCI": 42, "MTH": 22 }, { "SCI": 49, "MTH":...
๐ŸŒ
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 =...
๐ŸŒ
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 ยท
๐ŸŒ
Towards Data Science
towardsdatascience.com โ€บ home โ€บ latest โ€บ how to flatten deeply nested json objects in non-recursive elegant python
How to Flatten Deeply Nested JSON Objects in Non-Recursive Elegant Python | Towards Data Science
March 5, 2025 - Using the new iterative solution "flatten_json_iterative_solution" for example "pets": Unit test with another example "pets2" which is 3-level nested at key "dolphin".
๐ŸŒ
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 ...
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ how-to-parse-nested-json-in-python
How to Parse Nested JSON in Python - GeeksforGeeks
July 23, 2025 - In this article, we will discuss multiple ways to parse nested JSON in Python using built-in modules and libraries like json, recursion techniques and even pandas. Nested JSON refers to a JSON object that contains another JSON object (or an array of objects) inside it. ... In the above example, ...