How to define a dictionary in custom app module interface

I am getting back a dictionary from an API where the keys and values will be different for every API call, so I can’t use the normal ‘collection’ syntax.

"summary": {
      "NewsAndPolitics>Weather": 1,
      "Home&Garden>IndoorEnvironmentalQuality": 0.9043831825256348,
      "Science>Environment": 0.16117265820503235,
      "BusinessAndFinance>Industries>EnvironmentalServicesIndustry": 0.14393523335456848,
      "MedicalHealth>DiseasesAndConditions>LungAndRespiratoryHealth": 0.11401086300611496,
      "BusinessAndFinance>Business>GreenSolutions": 0.06348437070846558,
      "NewsAndPolitics>Disasters": 0.05041387677192688,
      "Travel>TravelLocations>PolarTravel": 0.01308488193899393,
      "HealthyLiving": 0.008222488686442375,
      "MedicalHealth>DiseasesAndConditions>ColdAndFlu": 0.0022315620444715023,
      "MedicalHealth>DiseasesAndConditions>HeartAndCardiovascularDiseases": 0.00213034451007843,
      "HealthyLiving>Wellness>SmokingCessation": 0.001540527562610805,
      "MedicalHealth>DiseasesAndConditions>Injuries": 0.0013950627762824297,
      "BusinessAndFinance>Industries>PowerAndEnergyIndustry": 0.0012570273829624057,
      "MedicalHealth>DiseasesAndConditions>Cancer": 0.001097781932912767,
      "MedicalHealth>DiseasesAndConditions>Allergies": 0.0010148967849090695,
      "MedicalHealth>DiseasesAndConditions>MentalHealth": 0.000717321818228811,
      "Style&Fashion>PersonalCare>DeodorantAndAntiperspirant": 0.0006022014422342181,
      "Technology&Computing>Computing>ComputerNetworking": 0.0005461975233629346,
      "MedicalHealth>DiseasesAndConditions>Injuries>FirstAid": 0.0004885646631009877
    }

How should I define a dictionary in my custom app module interface?

1 Like