title: Spring Resttemplate: Parsing using @JsonIgnore causes values to be null
body: <p>So, I am using Spring Boot 1.5.3 and am trying to a part  of the following Json - - namely <code>AccountId</code> and <code>Username</code>- (actually, it is an oData v2 interface getting from a SAP Netweaver instance) into a class using restTemplate.exchange:</p>
  
  <pre><code>{  
     "d":{  
        "__metadata":{  
           "id":"...",
           "uri":"...",
           "type":"...."
        },
        "AccountID":"0100000001",
        "Username":"test@test.com",
        "Partners":{  
           "__deferred":{  
              "uri":"Navigationproperty"
           }
        }
     }
  }
  </code></pre>
  
  <p>My class is set up like this, because for a start I only want to get the account id and name:</p>
  
  <pre><code>@JsonIgnoreProperties(ignoreUnknown = true)
  public class PortalAccount implements Serializable{
  
      public PortalAccount() {
      }
  
      @JsonProperty("AccountID")
      public String accountID;
  
      @JsonProperty("Username")
      public String username;
  
      public String getPortalAccountID() {
          return accountID;
      }
  
      public void setPortalAccountID(String portalAccountID) {
          this.accountID = portalAccountID;
      }
  
      public String getUsername() {
          return username;
      }
  
      public void setUsername(String username) {
          this.username = username;
      }
  
      @Override
      public String toString() {
          return "Account{" +
                  "accountID='" + accountID + '\'' +
                  ", username='" + username +'\'' +
                  '}';
      }
  }
  </code></pre>
  
  <p>and here's the way I try to call it:</p>
  
  <pre><code>        RestTemplate restTemplate = new RestTemplate();
          HttpHeaders httpHeaders = this.createHeaders();
          ResponseEntity&lt;String&gt; response;
          response  = restTemplate.exchange(uri,HttpMethod.GET,new HttpEntity&lt;Object&gt;(httpHeaders),String.class);
          ObjectMapper mapper = new ObjectMapper();
  
          PortalAccount acc = mapper.readValue(response.getBody(), PortalAccount.class);
  </code></pre>
  
  <p>I first tried to parse it directly like in the docs using <code>ResponseEntity&lt;PortalAccount&gt;</code>, but this just lead to an empty class (accountid = null, username = null), So i tried the way above using <code>ResponseEntity&lt;String&gt;</code> to see what I get when just parsing the response into the string representation. That way, I could make sure the json above is correctly returned, which it is.So, the values are definitely there, it has to be a matter of parsing, but I sadly don't get my way around this problem.</p>
  
  <p>I hope you could help me out here!</p>
  
  <p>edit: As one answer mentions, getForObject might work, but this leads for me to other problems, as I have to use basic authentication, so its not really viable.I also tried casing-issues, naming the Variables accountID or AccountID, which did not work out.</p>