Below is the provided JSON data:
data = {
"company_name": "חברה לדוגמה",
"audit_period_begin": "01/01/2021",
"audit_period_end": "31/12/2021",
"reports": [
{
"type": {
"he": "מאזן",
"en": "Balance Sheets"
},
"fin_statement": "BS",
"sections": [
{
"section_name": {
"he": "נכסים שוטפים",
"en": "Current Assets"
},
"totals": {
"2020": {
"final_total_local": 100000,
"final_total_foreign": 0
},
"2021": {
"final_total_local": 110000,
"final_total_foreign": 0
}
},
"subsections": [
{......(the rest is irrelevant)
My objective is to access the following in the code snippet:
data.reports[0].sections[0]['totals']
However, I'm encountering a specific error message:
Element implicitly has an 'any' type because expression of type '"totals"' can't be used to index type
This results in the inability to read the property. Can you clarify why?