Extracting Dictionary from Tree of Dictionaries

Viewed 22

I have a tree of dictionaries, I am trying to extract each one of them alone, so I can get the data (keys and values), but it's not working.

{
"fundNavList": {
    "status": "OK",
    "navList": [
        {
            "fundCode": "2",
            "fundCurrency": "EGP",
            "fundTitle": "OSOUL FUND​​​",
            "nav": 538.71,
            "navDate": 20220921.0
        },
        {
            "fundCode": "3",
            "fundCurrency": "EGP",
            "fundTitle": "Istethmar Fund",
            "nav": 196.5,
            "navDate": 20220921.0
        },
        {
            "fundCode": "4",
            "fundCurrency": "EGP",
            "fundTitle": "Aman Fund",
            "nav": 111.34,
            "navDate": 20220921.0
        },
        {
            "fundCode": "5",
            "fundCurrency": "EGP",
            "fundTitle": "Hemaya Fund",
            "nav": 301.88,
            "navDate": 20220901.0
        },
        {
            "fundCode": "6",
            "fundCurrency": "EGP",
            "fundTitle": "Thabat Fund",
            "nav": 391.55,
            "navDate": 20220921.0
        },
        {
            "fundCode": "7",
            "fundCurrency": "EGP",
            "fundTitle": "Misr ElMostakbal Fund​​",
            "nav": 22.34,
            "navDate": 20220918.0
        },
        {
            "fundCode": "8",
            "fundCurrency": "EGP",
            "fundTitle": "Takamol Fund",
            "nav": 202.97,
            "navDate": 20220921.0
        }
    ]
}

}

This tree is located at https://www.cibeg.com/api/fund/getfunds. I added it in Insomnia so I can get (what seems to be the tree of dicts) as presented in the code above.

I tried everything but all failed. any advice or approach i should use?

1 Answers

you can just acess the values by the key for example

new_dict = your_dict["fundNavList"]
other_dict = your_dict["fundNavList"]["navList"][0]

other_dict is the first dict from ther array "navList"

Related