title: How to ignore @JsonProperty while converting object to map by Jackson
body: <p>For example, I have a class <code>User</code> which has only 2 fields - <code>name</code> and <code>identification</code> which annotated by <code>@JsonProperty</code> respectively. And I use <code>Jackson</code> to convert this object to a <code>Map</code>, but the result is not what I expected. I want to the all the keys in the result map to be what I declared in <code>User</code>, not the value in <code>@JsonProperty</code>.</p>
  
  <p><strong>Class User</strong></p>
  
  <pre><code>class User {
      @JsonProperty("username")
      private String name;
  
      @JsonProperty("id")
      private int identification;
  
      //constructor, getters, setters and toString
  }
  </code></pre>
  
  <p><strong>Code snippet</strong></p>
  
  <pre><code>ObjectMapper mapper = new ObjectMapper();
  User user = new User("Bob", 123);
  System.out.println(user.toString());
  
  Map&lt;String, Object&gt; result = mapper.convertValue(user, Map.class);
  System.out.println(result.toString());
  </code></pre>
  
  <p><strong>Console output</strong></p>
  
  <blockquote>
    <p>User [name=Bob, identification=123]<br>
    {username=Bob, id=123}</p>
  </blockquote>
  
  <p>But what I expected output for map is as follows. The field name should be the same defined in class <strong>User</strong>, not the value specified in <code>@JsonProperty</code>. BTW, I cannot remove the <code>@JsonProperty</code> because they are used for serialization/deserialization somewhere.</p>
  
  <blockquote>
    <p>{name=Bob, identification=123}</p>
  </blockquote>
  
  <p>Any advice and suggestions will be greatly appreciated. Thanks!</p>