Coding Global Background
Coding Global

Print JSON Keys

Archiviert 3 years ago
3 Nachrichten
2 Mitglieder
Erstellt 3 years ago
Aktualisiert 3 years ago
In Discord öffnen
I
ItIzYe

Spielt Custom Status

Verified
Hi, I'm working on a To do script and i currently have this JSON file:
{
    "todos": {
        "label": {
            "edu": {},
            "work": {
                "jkl": {
                    "description": "jkl",
                    "timer": "jkl"
                },
                "cvb": {
                    "description": "cvb",
                    "timer": "vcb"
                },
                "yxc": {
                    "description": "yxc",
                    "timer": "yxc"
                },
                "uio": {
                    "description": "uio",
                    "timer": "uio"
                },
                "asd": {
                    "description": "asd",
                    "timer": "asd"
                },
                "wer": {
                    "description": "wer",
                    "timer": "wer"
                }
            },
            "personal": {}
        }
    }
}

and i use this loop to print:
if yn.lower() == "y":
    for key in data['todos']['label']['work']:
        print(data['todos']['label']['work'][key])

i want to get the keys in "work" to get printed, however i only get the values. Can somebody help me find a solution?

Antworten (3)