title: How to deserialize distinct JSON objects to an array of that objects?
body: <p>Trying to deserialize an api repsonse like this:</p>
  <pre><code>{
    &quot;Afghanistan&quot;: {
      &quot;All&quot;: {
        &quot;confirmed&quot;: 157725,
        &quot;recovered&quot;: 0,
        &quot;deaths&quot;: 7332,
        &quot;country&quot;: &quot;Afghanistan&quot;,
        &quot;population&quot;: 35530081,
        &quot;sq_km_area&quot;: 652090,
        &quot;life_expectancy&quot;: &quot;45.9&quot;,
        &quot;elevation_in_meters&quot;: null,
        &quot;continent&quot;: &quot;Asia&quot;,
        &quot;abbreviation&quot;: &quot;AF&quot;,
        &quot;location&quot;: &quot;Southern and Central Asia&quot;,
        &quot;iso&quot;: 4,
        &quot;capital_city&quot;: &quot;Kabul&quot;,
        &quot;lat&quot;: &quot;33.93911&quot;,
        &quot;long&quot;: &quot;67.709953&quot;,
        &quot;updated&quot;: &quot;2021-12-17 04:22:14&quot;
      }
    },
    &quot;Albania&quot;: {
      &quot;All&quot;: {
        &quot;confirmed&quot;: 204928,
        &quot;recovered&quot;: 0,
        &quot;deaths&quot;: 3156,
        &quot;country&quot;: &quot;Albania&quot;,
        &quot;population&quot;: 2930187,
        &quot;sq_km_area&quot;: 28748,
        &quot;life_expectancy&quot;: &quot;71.6&quot;,
        &quot;elevation_in_meters&quot;: null,
        &quot;continent&quot;: &quot;Europe&quot;,
        &quot;abbreviation&quot;: &quot;AL&quot;,
        &quot;location&quot;: &quot;Southern Europe&quot;,
        &quot;iso&quot;: 8,
        &quot;capital_city&quot;: &quot;Tirana&quot;,
        &quot;lat&quot;: &quot;41.1533&quot;,
        &quot;long&quot;: &quot;20.1683&quot;,
        &quot;updated&quot;: &quot;2021-12-17 04:22:14&quot;
      }
    },
    &quot;Algeria&quot;: {
      &quot;All&quot;: {
        ...
      }
    }
  }
  </code></pre>
  <p>and so on up to ~200 countries.</p>
  <p>The problem is the format that implies me to trait each country as an individual object:</p>
  <pre><code>public class ApiResponse {
      private Afghanistan afghanistan;
      private Afghanistan albania;
      private Afghanistan algeria;
      private Afghanistan andorra;
      private Afghanistan angola;
      private Afghanistan antiguaAndBarbuda;
      private Afghanistan argentina;
      private Afghanistan armenia;
      private Australia australia;
      ...
  </code></pre>
  <p>Hence I would like to have an array of countries, say:</p>
  <pre><code>{
    &quot;countries&quot;:[    
      {
      &quot;All&quot;: {
        &quot;confirmed&quot;: 157725,
        &quot;recovered&quot;: 0,
        &quot;deaths&quot;: 7332,
        &quot;country&quot;: &quot;Afghanistan&quot;,
        &quot;population&quot;: 35530081,
        &quot;sq_km_area&quot;: 652090,
        &quot;life_expectancy&quot;: &quot;45.9&quot;,
        &quot;elevation_in_meters&quot;: null,
        &quot;continent&quot;: &quot;Asia&quot;,
        &quot;abbreviation&quot;: &quot;AF&quot;,
        &quot;location&quot;: &quot;Southern and Central Asia&quot;,
        &quot;iso&quot;: 4,
        &quot;capital_city&quot;: &quot;Kabul&quot;,
        &quot;lat&quot;: &quot;33.93911&quot;,
        &quot;long&quot;: &quot;67.709953&quot;,
        &quot;updated&quot;: &quot;2021-12-17 04:22:14&quot;
      },    
      {
      &quot;All&quot;: {
        &quot;confirmed&quot;: 204928,
        &quot;recovered&quot;: 0,
        &quot;deaths&quot;: 3156,
        &quot;country&quot;: &quot;Albania&quot;,
        &quot;population&quot;: 2930187,
        &quot;sq_km_area&quot;: 28748,
        &quot;life_expectancy&quot;: &quot;71.6&quot;,
        &quot;elevation_in_meters&quot;: null,
        &quot;continent&quot;: &quot;Europe&quot;,
        &quot;abbreviation&quot;: &quot;AL&quot;,
        &quot;location&quot;: &quot;Southern Europe&quot;,
        &quot;iso&quot;: 8,
        &quot;capital_city&quot;: &quot;Tirana&quot;,
        &quot;lat&quot;: &quot;41.1533&quot;,
        &quot;long&quot;: &quot;20.1683&quot;,
        &quot;updated&quot;: &quot;2021-12-17 04:22:14&quot;
      }
    ]
  }  
  </code></pre>
  <p>I've already started digging into custom deserializers but couldn't figure out how to implement it yet. Appreciate any advice.</p>