'Python extract only 'key' values in in nested JSON where 'value' is a dictionary in a list

I have the folowing Json:

    {
  "10208": [
    {
      "11003": {
        "totalExecutions": 1,
        "endDate": "",
        "description": "",
        "totalExecuted": 0,
        "started": "",
        "versionName": "v2",
        "expand": "executionSummaries",
        "projectKey": "TEST",
        "versionId": 10208,
        "modifiedBy": "",
        "projectId": 10203,
        "startDate": "",
        "executionSummaries": {
          "executionSummary": []
        }
      },
      "recordsCount": 1
    }
  ],
  "-1": [
    {
      "11005": {
        "totalExecutions": 2,
        "endDate": "",
        "description": "",
        "totalExecuted": 1,
        "started": "",
        "versionName": "Unscheduled",
        "expand": "executionSummaries",
        "modifiedBy": "",
        "projectId": 10203,
        "startDate": "",
        "executionSummaries": {
          "executionSummary": []
        }
      },
      "recordsCount": 1
    }
  ]
}

I need to get

11003,11005

as output (better if it could be save in csv).this is actually the data i'm getting off a webpage(using requests). super new to Json.. any help would be appreciated



Solution 1:[1]

Use built-in json.loads(json: str) to parse json string to python dict.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 sudden_appearance