I have a Dictionary containing downloaded information about the performance of my household electrical systems. To be clear, the API I am using returns a JSON array which requests is converting into the Dictionary. Its contents, displayed by print(), look like:
{‘energyDetails’: {‘timeUnit’: ‘DAY’, ‘unit’: ‘Wh’, ‘meters’: [{‘type’: ‘Production’, ‘values’: [{‘date’: ‘2024-12-19 00:00:00’, ‘value’: 9426.24}, {‘date’: ‘2024-12-20 00:00:00’, ‘value’: 902.317}, {‘date’: ‘2024-12-21 00:00:00’, ‘value’: 1082.8201}, {‘date’: ‘2024-12-22 00:00:00’, ‘value’: 2830.143},…]} {‘type’: ‘Consumption’, ‘values’: [{‘date’: ‘2024-12-19 00:00:00’, ‘value’: 45110.242}, {‘date’: ‘2024-12-20 00:00:00’, ‘value’: 46978.316}, {‘date’: ‘2024-12-21 00:00:00’, ‘value’: 55941.82}, {‘date’: ‘2024-12-22 00:00:00’, ‘value’: 63911.145},…]}]}}
In reality, there are a substantially larger number of date/value pairs in each meter type block than I have copied here. I need to iterate over the date/value pairs separately for each meter type to get cumulative totals, and I am having a lot of trouble figuring out how to reference the sub-dictionaries so that I can do this. The documentation I can find only seems to consider straightforward tree structures, and the structure I have here is significantly more complex than that. Any pointers will be appreciated!