title: Java Jackson: Deserialize JSON with dynamic Names into JavaClass
body: <p>I'm trying to deserialize JSON using jackson. The problem is that field names always change.</p>
  <p>Here is an example JSON:</p>
  <pre><code>{
   2021-08-02: [
     {
        label: &quot;OnlineGallery&quot;,
        nb_uniq_visitors: 1,
        nb_visits: 2,
        nb_events: 2,
        nb_events_with_value: 0,
        sum_event_value: 0,
        min_event_value: 0,
        max_event_value: 0,
        avg_event_value: 0,
        segment: &quot;eventCategory==OnlineGallery&quot;,
        idsubdatatable: 1
     }
   ],
   2021-08-03: [ ],
   2021-08-04: [ ]
  }
  </code></pre>
  <p>I´m getting the data by Resttemplate and try to deserialize into Java Class but it doesn't work:</p>
  <pre><code>private EventsGetCategory getEventFromAPI(Date startdate, Date enddate) {
      RestTemplate restTemplate = new RestTemplate();
  
      DateFormat dateFormat = new SimpleDateFormat(&quot;yyyy-mm-dd&quot;);
  
      ResponseEntity&lt;EventsGetCategory&gt; response =
          restTemplate.getForEntity(
              matomoUrl + &quot;index.php?module=API&amp;label=OnlineGallery&amp;method=Events.getCategory&amp;secondaryDimension=eventAction&amp;idSite=1&amp;period=day&amp;date=&quot; + dateFormat.format(startdate) + &quot;,&quot; + dateFormat.format(enddate) + &quot;&amp;format=JSON&amp;filter_limit=-1&quot;
                  + &quot;&amp;token_auth=&quot; + tokenAuth,
              EventsGetCategory.class);
  
      return response.getBody();
    }
  </code></pre>
  <p><strong>EventsGetCategory Class:</strong></p>
  <pre><code>@Data
  public class EventsGetCategory {
  
    @JsonAnySetter
    private Map&lt;String, List&lt;EventDetails&gt;&gt; details;
  
  }
  </code></pre>
  <p><strong>EventDetails Class:</strong></p>
  <pre><code>@Data
  public class EventDetails {
  
    String label;
    int nb_uniq_visitors;
    int nb_visits;
    int nb_events;
    int nb_events_with_value;
    int sum_event_value;
    int min_event_value;
    int max_event_value;
    int avg_event_value;
    String segment;
    int idsubdatatable;
  
  }
  </code></pre>
  <p>Can someone help me please?</p>