skip to Main Content

Dynamic values within a JSON parameter using Python

To be clear, I am practicing my Python skills using CoinMarketCaps API. The below code works great: import json # 1 JSON string in list, works info_1_response = ['{"status": {"timestamp": "2023-01-25T22:59:58.760Z", "error_code": 0, "error_message": null, "elapsed": 16, "credit_count": 1, "notice":…

VIEW QUESTION

Parsing JSON with Python to retrieve values within a dictionary

I am trying to parse JSON and retrieve a certain value (ID) but I am getting the following error: TypeError: string indices must be integers The following is my code and JSON: import json # JSON string info_symbol = '{"status":{"timestamp":"2023-01-21T15:18:43.937Z","error_code":0,"error_message":null,"elapsed":21,"credit_count":1,"notice":null},"data":{"BITCOIN":{"id":15907,"name":"HarryPotterObamaSonic10Inu","symbol":"BITCOIN"}}}'…

VIEW QUESTION
Back To Top
Search