title: Mapping an Object with variable name in Jackson
body: <p>I have the following JSON:</p>
  <pre class="lang-json prettyprint-override"><code>{
   &quot;filebeat&quot;: {
     &quot;version&quot;: 2,
     &quot;modified_date&quot;: &quot;2021-01-15T14:02:41.103Z&quot;,
     &quot;policy&quot;: {
       &quot;phases&quot;: {
         &quot;hot&quot;: {
           &quot;min_age&quot;: &quot;0ms&quot;,
           &quot;actions&quot;: {
             &quot;rollover&quot;: {
               &quot;max_size&quot;: &quot;30gb&quot;,
               &quot;max_age&quot;: &quot;1d&quot;
             }
           }
         },
         &quot;delete&quot;: {
           &quot;min_age&quot;: &quot;90d&quot;,
           &quot;actions&quot;: {
             &quot;wait_for_snapshot&quot;: {
               &quot;policy&quot;: &quot;mainbackuppolicy&quot;
             }
           }
         }
       }
     }
   },
   &quot;ilm-history-ilm-policy&quot;: {
     &quot;version&quot;: 1,
     &quot;modified_date&quot;: &quot;2020-12-08T14:31:15.717Z&quot;,
     &quot;policy&quot;: {
       &quot;phases&quot;: {
         &quot;hot&quot;: {
           &quot;min_age&quot;: &quot;0ms&quot;,
           &quot;actions&quot;: {
             &quot;rollover&quot;: {
               &quot;max_size&quot;: &quot;50gb&quot;,
               &quot;max_age&quot;: &quot;30d&quot;
             }
           }
         },
         &quot;delete&quot;: {
           &quot;min_age&quot;: &quot;90d&quot;,
           &quot;actions&quot;: {
             &quot;delete&quot;: {
               &quot;delete_searchable_snapshot&quot;: true
             }
           }
         }
       }
     }
   },
   &quot;kibana-event-log-policy&quot;: {
     &quot;version&quot;: 3,
     &quot;modified_date&quot;: &quot;2020-12-08T14:39:00.097Z&quot;,
     &quot;policy&quot;: {
       &quot;phases&quot;: {
         &quot;hot&quot;: {
           &quot;min_age&quot;: &quot;0ms&quot;,
           &quot;actions&quot;: {
             &quot;rollover&quot;: {
               &quot;max_size&quot;: &quot;50gb&quot;,
               &quot;max_age&quot;: &quot;30d&quot;
             }
           }
         },
         &quot;delete&quot;: {
           &quot;min_age&quot;: &quot;90d&quot;,
           &quot;actions&quot;: {
             &quot;delete&quot;: {
               &quot;delete_searchable_snapshot&quot;: true
             }
           }
         }
       }
     }
   },
   &quot;logs&quot;: {
     &quot;version&quot;: 1,
     &quot;modified_date&quot;: &quot;2020-12-08T14:31:15.227Z&quot;,
     &quot;policy&quot;: {
       &quot;phases&quot;: {
         &quot;hot&quot;: {
           &quot;min_age&quot;: &quot;0ms&quot;,
           &quot;actions&quot;: {
             &quot;rollover&quot;: {
               &quot;max_size&quot;: &quot;50gb&quot;,
               &quot;max_age&quot;: &quot;30d&quot;
             }
           }
         }
       }
     }
   },
   &quot;metricbeat&quot;: {
     &quot;version&quot;: 2,
     &quot;modified_date&quot;: &quot;2021-01-15T14:02:42.090Z&quot;,
     &quot;policy&quot;: {
       &quot;phases&quot;: {
         &quot;hot&quot;: {
           &quot;min_age&quot;: &quot;0ms&quot;,
           &quot;actions&quot;: {
             &quot;rollover&quot;: {
               &quot;max_size&quot;: &quot;30gb&quot;,
               &quot;max_age&quot;: &quot;1d&quot;
             }
           }
         },
         &quot;delete&quot;: {
           &quot;min_age&quot;: &quot;90d&quot;,
           &quot;actions&quot;: {
             &quot;wait_for_snapshot&quot;: {
               &quot;policy&quot;: &quot;mainbackuppolicy&quot;
             }
           }
         }
       }
     }
   },
   &quot;metrics&quot;: {
     &quot;version&quot;: 1,
     &quot;modified_date&quot;: &quot;2020-12-08T14:31:15.475Z&quot;,
     &quot;policy&quot;: {
       &quot;phases&quot;: {
         &quot;hot&quot;: {
           &quot;min_age&quot;: &quot;0ms&quot;,
           &quot;actions&quot;: {
             &quot;rollover&quot;: {
               &quot;max_size&quot;: &quot;50gb&quot;,
               &quot;max_age&quot;: &quot;30d&quot;
             }
           }
         }
       }
     }
   },
   &quot;ml-size-based-ilm-policy&quot;: {
     &quot;version&quot;: 1,
     &quot;modified_date&quot;: &quot;2020-12-08T14:31:15.083Z&quot;,
     &quot;policy&quot;: {
       &quot;phases&quot;: {
         &quot;hot&quot;: {
           &quot;min_age&quot;: &quot;0ms&quot;,
           &quot;actions&quot;: {
             &quot;rollover&quot;: {
               &quot;max_size&quot;: &quot;50gb&quot;
             }
           }
         }
       }
     }
   },
   &quot;slm-history-ilm-policy&quot;: {
     &quot;version&quot;: 1,
     &quot;modified_date&quot;: &quot;2020-12-08T14:31:15.585Z&quot;,
     &quot;policy&quot;: {
       &quot;phases&quot;: {
         &quot;hot&quot;: {
           &quot;min_age&quot;: &quot;0ms&quot;,
           &quot;actions&quot;: {
             &quot;rollover&quot;: {
               &quot;max_size&quot;: &quot;50gb&quot;,
               &quot;max_age&quot;: &quot;30d&quot;
             }
           }
         },
         &quot;delete&quot;: {
           &quot;min_age&quot;: &quot;90d&quot;,
           &quot;actions&quot;: {
             &quot;delete&quot;: {
               &quot;delete_searchable_snapshot&quot;: true
             }
           }
         }
       }
     }
   },
   &quot;synthetics&quot;: {
     &quot;version&quot;: 1,
     &quot;modified_date&quot;: &quot;2020-12-08T14:31:15.352Z&quot;,
     &quot;policy&quot;: {
       &quot;phases&quot;: {
         &quot;hot&quot;: {
           &quot;min_age&quot;: &quot;0ms&quot;,
           &quot;actions&quot;: {
             &quot;rollover&quot;: {
               &quot;max_size&quot;: &quot;50gb&quot;,
               &quot;max_age&quot;: &quot;30d&quot;
             }
           }
         }
       }
     }
   },
   &quot;watch-history-ilm-policy&quot;: {
     &quot;version&quot;: 1,
     &quot;modified_date&quot;: &quot;2020-12-08T14:31:15.792Z&quot;,
     &quot;policy&quot;: {
       &quot;phases&quot;: {
         &quot;delete&quot;: {
           &quot;min_age&quot;: &quot;7d&quot;,
           &quot;actions&quot;: {
             &quot;delete&quot;: {
               &quot;delete_searchable_snapshot&quot;: true
             }
           }
         }
       }
     }
   }
  }
  </code></pre>
  <p>I do not know how I can map these JSON elements to the corresponding object since its name is variable e.g. filebeat, ilm-history-ilm-policy, etc.</p>
  <p>I created the following Objects:</p>
  <pre class="lang-java prettyprint-override"><code>public class IndexLifeCycleManagement {
      private IndexLifeCycleManagementPolicy indexLifeCycleManagementPolicy;
  }
  </code></pre>
  <pre class="lang-java prettyprint-override"><code>public class IndexLifeCycleManagementPolicy {
  
      @JsonProperty(&quot;modified_date&quot;)
      private String modifiedDate;
  
      @JsonProperty(&quot;version&quot;)
      private int version;
  
      @JsonProperty(&quot;policy&quot;)
      private Policy policy;
  }
  </code></pre>
  <p>But I think the problem lies in the fact that Jackson cannot map <em>filebeat</em> to a <em>IndexLifecycleManagement</em>-object</p>
  <p>Thanks in advance
  Regards</p>