title: Can't bind json string to java string
body: <p>I'm trying pass a json string to (POJO) java string, but in my controller I'm not getting that json string as a java string.</p>
  
  <p>In frontend,</p>
  
  <pre class="lang-jsp prettyprint-override"><code>&lt;form th:action="@{/create/ads}" th:object="${createAds}" method="post"&gt;
      &lt;div class="allWrap"&gt;
          &lt;ul class="dropList odaberiteMarku" th:field="${brand}"&gt;
  
          &lt;/ul&gt;
      &lt;/div&gt;
  
      &lt;div class="allWrap mt-s"&gt;
          &lt;ul class="dropList odaberiteModel" th:field="${model}"&gt;
  
          &lt;/ul&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>In Controller,</p>
  
  <pre><code>@RequestMapping(value="/create/ads", headers="Accept=application/json", method=RequestMethod.POST)
  public String submitForm(@RequestBody @ModelAttribute CreateAds ads, BindingResult result, Model model) {
      if (result.hasErrors()) {
          return "test";
      }
      System.out.println(ads.getBrand()+", "+ads.getModels());
      return "successful";
  }
  </code></pre>
  
  <p>In model class</p>
  
  <pre><code>public class CreateAds {
      private String brand;
      private String models;
      //other variables
      //all getters and setters 
  }
  </code></pre>
  
  <p>In my json file.</p>
  
  <pre><code>[
    {
      "brand": "Acura",
      "models": [
        "2.2CL",
        "2.3CL",
        "3.0CL",
        "TL",
        "TSX",
        "Vigor",
        "ZDX"
      ]
    }
  ]
  </code></pre>
  
  <p><strong>In frontend:</strong> I have an external json file which is used for car manufacturer and car model based on car manufacturer. It works fine in frontend.</p>
  
  <p><strong>In backend:</strong> I'm trying to bind json string to normal string, like json brand string should go java brand string and models string should go java models string.  </p>
  
  <p>I think, I can't bind json string to java string properly that's why I'm getting null value. So how can I solve this problem?</p>
  
  <p>Thanks in advance.</p>