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 …
🌐
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)
🌐
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()
🌐
Reddit
reddit.com › r/python › parse multi-level json in python
r/Python on Reddit: parse multi-level json in python
April 9, 2018 -

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!

🌐
Zyte
zyte.com › home › blog › json parsing with python [practical guide]
JSON Parsing with Python [Practical Guide]
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.
🌐
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', ...
🌐
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.
🌐
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 ...
Find elsewhere
🌐
Stack Overflow
stackoverflow.com › questions › 47981652 › parsing-json-with-multiple-levels-with-python
Parsing Json with multiple "levels" with Python - Stack Overflow
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
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
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().
🌐
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
🌐
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 ...
🌐
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 - The function "flatten_json_iterative_solution" solved the nested JSON problem with an iterative approach. The idea is that we scan each element in the JSON file and unpack just one level if the element is nested.
🌐
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.