0

i have json data as shown below the problem is each user has uniqe id that is generated rondomly and his data located below this id i want to extract each user id and the data of that user in list and repeate this process for each user

{
    "JnuvXZI3xIYgbhNzxXodIS4o3SY2": {
        "Name": "zizoooo",
        "age": 50,
        "phoneNumber": 1009707164,
        "readings": {
            "HP": 35,
            "SpO2": 40,
            "ecg": 30,
            "preesure": 80,
            "temp": 37
        }
    },
    "WdptGIALJEgVU8gIiZUZgsQrKNt1": {
        "Name": "zizoelshehry",
        "age": 40,
        "phoneNumber": 1009707164,
        "readings": {
            "HP": 35,
            "SpO2": 40,
            "ecg": 30,
            "preesure": 80,
            "temp": 37
        }
    }
}
Andrej Kesely
  • 118,151
  • 13
  • 38
  • 75
  • 5
    And what have you tried? `json.load` will do this job for you. You'll get a dictionary with the user ID as key. – Tim Roberts May 25 '22 at 21:20
  • i want to put the user id for example "JnuvXZI3xIYgbhNzxXodIS4o3SY2" and the data below it in the list index and the next user for the in the next index and so on – ahmad nader May 25 '22 at 21:24
  • Does this answer your question? [Reading JSON from a file?](https://stackoverflow.com/questions/20199126/reading-json-from-a-file) – fsimonjetz May 25 '22 at 21:29
  • 2
    That's exactly what a JSON reader does. Read about the `json` module. – Tim Roberts May 25 '22 at 21:48

0 Answers0