title: How do I pass list of objects to Rest API POST Method?
body: <p>I'm creating a Spring boot REST API which should take 2 Lists of custom objects. I'm not able to correctly pass a POST body to the API I've created. Any idea what might be going wrong ? </p>
  
  <p>Below is my code : </p>
  
  <p>Controller Class Method : 
  // Main controller Class which is called from the REST API. Just the POST method for now.</p>
  
  <pre><code>@RequestMapping(value = "/question1/solution/", method = RequestMethod.POST)
      public List&lt;Plan&gt; returnSolution(@RequestBody List&lt;Plan&gt; inputPlans, @RequestBody List&lt;Feature&gt; inputFeatures) {
          logger.info("Plans received from user are : " + inputPlans.toString());
          return planService.findBestPlan(inputPlans, inputFeatures);
      }
  </code></pre>
  
  <p>Plan Class , this will contain the Feature class objects in an array: </p>
  
  <pre><code>public class Plan {
  
      public Plan(String planName, double planCost, Feature[] features) {
          this.planName = planName;
          this.planCost = planCost;
          this.features = features;
      }
  
      public Plan() {
  
      }
  
      private String planName;
      private double planCost;
      Feature[] features;
  
      public String getPlanName() {
          return planName;
      }
  
  // getters &amp; setters
  }
  </code></pre>
  
  <p>Feature POJO Class : 
  // Feature will contain features like - email , archive etc.</p>
  
  <pre><code>public class Feature implements Comparable&lt;Feature&gt; {
      public Feature(String featureName) {
          this.featureName = featureName;
      }
  
      public Feature() {
  
      }
  
      private String featureName;
  
      // Getters / Setters
  
      @Override
      public int compareTo(Feature inputFeature) {
          return this.featureName.compareTo(inputFeature.getFeatureName());
      }
  }
  </code></pre>