title: Proper way to allow json with and without root node using spring mvc and jackson
body: <p>I have the following controller method:</p>
  
  <pre><code>@RequestMapping(value = "/v1/users/{userId}/settings", method = RequestMethod.POST, produces = { "application/json" }, consumes = { "application/json" })
  @ResponseStatus(value = HttpStatus.CREATED)
  @ResponseBody
  public UserSetting createUserSetting(@PathVariable("userId") String userId,
          @RequestBody Setting setting){
      return userSettingService.createSetting(userId, userSetting);
  }
  </code></pre>
  
  <p>When invoking the url /v1/users/12345/settings POST</p>
  
  <p>with the payload</p>
  
  <pre><code>{"Setting":{"name":"CoolSetting", "id":"SETTING-ID"}}
  </code></pre>
  
  <p>the method behaves as expected.</p>
  
  <p>What I would also like to accept is:</p>
  
  <pre><code>{"name":"CoolSetting", "id": "SETTING-ID"}
  </code></pre>
  
  <p>how do I accept the second payload version without the root tag.</p>
  
  <p>The object in question looks like this</p>
  
  <pre><code>public class Setting{
      @JsonProperty
      private String id;
  
      @JsonProperty
      private String name;
      //getters and setters removed
  }
  </code></pre>
  
  <p>how can I tell spring to marshel using either json method?</p>