title: JSON object and Spring @RequestParam
body: <p>I'm manipulating the following JSON object in my website frontend</p>
  
  <pre><code>&lt;script&gt;
  window.campaign = {
      name: "test",
      budget: 20.00,
      type: 0,
      dynamic: false,
      geo_target: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27],
      time_target: {
          monday: ["00","00","00","00",1],
          tuesday: ["00","00","00","00",1],
          wednesday: ["00","00","00","00",1],
          thursday: ["00","00","00","00",1],
          friday: ["00","00","00","00",1],
          saturday: ["00","00","00","00",1],
          sunday: ["00","00","00","00",1]
      },
  
      setName: function(val) {
          this.name = val;
      },
  
      //some more setters go here
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>Then I send it to my Spring application using AJAX</p>
  
  <pre><code>$.ajax({ type: "POST", url: submit_url, data: JSON.stringify(window.campaign) })
  .done(function() { alert( "success" ); })
  .fail(function() { alert( "error" ); });
  </code></pre>
  
  <p>Now the problem is mapping all the variables accordingly in my <code>@Controller</code></p>
  
  <pre><code>....
  @RequestParam(value = "name", required = false, defaultValue = "") String name,
  @RequestParam(value = "budget", required = false, defaultValue = "0") BigDecimal budget,
  @RequestParam(value = "type", required = false, defaultValue = "0") int type,
  @RequestParam(value = "dynamic", required = false, defaultValue = "false") boolean dynamic,
  @RequestParam(value = "geo_target", required = false, defaultValue = "") int[] geoTargeting,
  ....
  </code></pre>
  
  <p>This all works fine, but I have no idea how to map the <code>time_target</code></p>
  
  <p>I tried creating a new <code>Model</code> and mapping it using <code>@RequestBody</code></p>
  
  <pre><code>....
  @RequestParam(value = "name", required = false, defaultValue = "") String name,
  ....
  @RequestParam(value = "geo_target", required = false, defaultValue = "") int[] geoTargeting,    
  @RequestBody TimeTarget timeTargeting
  ....
  </code></pre>
  
  <p>with no success. I used <a href="http://www.jsonschema2pojo.org" rel="nofollow noreferrer">http://www.jsonschema2pojo.org</a> to create a <code>Class</code> for the whole object I'm sending, but no success whatsoever (just FYI, it created two classes, one for timeTargeting and one for everything else).</p>
  
  <p>I'm getting really desperate. Help, please :) If the code provided is not enough, I can update with more.</p>