E
E
Eduard Talovikov2019-11-07 17:05:30
Python
Eduard Talovikov, 2019-11-07 17:05:30

How to pull data from all levels in json file via python?

{
    "id": "2beff3ee-a690-4578-a01f-00304a4d3e7e",
    "user": null,
    "properties": [
{
        "name": "Description",
        "oldValue": null,
},
{
        "name": "DetectedAt",
},
{
        "name": "Events",
        "oldValue": null,
        "newValue": null
},
{
        "name": "Groups",
        "oldValue": null,
        "newValue": null
},
{
        "name": "Type",
        "oldValue": null,
        "newValue": "BruteForce"
}
]
},
"reporter": null,
"assigned": null,
"influence": null,
"groups": [
{
        "id": "00000000-0000-0000-0000-000000000003",
        "name": "Unmanaged hosts",
        "accessibility": "granted"
}
],
"targets": {
        "groups": [],
        "assets": [],
        "networks": [],
        "addresses": [],
        "others": [
{
            "id": "12174b51-1d80-0001-0000-0000000014d2",
            "name": "252545"
},
{
            "id": "12174b51-1d80-0001-0000-0000000014d3",
            "name": "145548"
},
{
            "id": "12174b51-1d80-0001-0000-0000000014d4",
            "name": "1345323"
},
{
            "id": "12174b51-1d80-0001-0000-0000000014d5",
            "name": "13452540"
},
{
            "id": "12174b51-1d80-0001-0000-0000000014d6",
            "name": "134254"
},
{
            "id": "12174b51-1d80-0001-0000-0000000014d7",
            "name": "13253456"
},
{
            "id": "12174b51-1d80-0001-0000-0000000014d8",
            "name": "1345325"
},
{
            "id": "12174b51-1d80-0001-0000-0000000014d9",
            "name": "1255211"
}
]
}

How do I pull data from name which is in target,other; then I will add the data to the dictionary

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Kuts, 2019-11-07
@fox_12

Something like this:
[x['name'] for x in data['targets']['others']]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question